How to get SQL Server Version on multiple Servers on Azure using Power shell.

Brass Contributor

I have 300 servers on azure, i have to find the details of SQL Server Version in all servers on Azure.

how to do this using Power shell?

(like i can put the name of the servers in a file and get the output in another file).

3 Replies


Follow this script:

Get-AzureRmSqlServer [[-ResourceGroupName] <String>] [[-ServerName] <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]


I hope this helps!





Thanks for the answer.


I am confused in this, where to put which value.


suppose my Server name is ABC and resource group is XYZ. actually i am confused in parameters and in string.


Get-AzureRmSqlServer [[-XYZ] <String>] [[-ABC] <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]

The command would be:
get-azureRmSqlServer -resourceGroupname XYZ -serverName ABC

What follows after the dash(-) is the parameter name and it takes a value.
You mentioned you have 300 servers so you'll have to use a looping mechanism to run the command for each server name. One of the ways is to have a .txt file with each server name on a separate line and pipe it to a forEach-object. Example:
get-content -path c:\temp\server-list.txt | forEach-object {get-azureRmSqlServer -resourceGroupname XYZ -serverName $_}