Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Get-AzSqlServer
- Module:
- Az.Sql Module
Returns information about SQL Database servers.
Syntax
Default (Default)
Get-AzSqlServer
[[-ResourceGroupName] <String>]
[[-ServerName] <String>]
[-ExpandActiveDirectoryAdministrator]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Get-AzSqlServer cmdlet returns information about one or more Azure SQL Database servers. Specify the name of a server to see information for only that server.
Examples
Example 1: Get all instances of SQL Server assigned to a resource group
Get-AzSqlServer -ResourceGroupName "ResourceGroup01"
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server01.database.windows.net
ResourceGroupName : resourcegroup01
ServerName : server02
Location : West US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server02.database.windows.net
This command gets information about all the Azure SQL Database servers assigned to the resource group ResourceGroup01.
Example 2: Get information about an Azure SQL Database server
Get-AzSqlServer -ResourceGroupName "ResourceGroup01" -ServerName "Server01"
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server01.database.windows.net
This command gets information about the Azure SQL Database server named Server01.
Example 3: Get all instances of SQL Server in the subscription
Get-AzResourceGroup | Get-AzSqlServer
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server01.database.windows.net
ResourceGroupName : resourcegroup01
ServerName : server02
Location : West US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server02.database.windows.net
ResourceGroupName : resourcegroup02
ServerName : server03
Location : East US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server03.database.windows.net
This command gets information about all the Azure SQL Database servers in the current subscription.
Example 4: Get all instances of SQL Server assigned to a resource group using filtering
Get-AzSqlServer -ResourceGroupName "ResourceGroup01" -ServerName "server*"
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server01.database.windows.net
ResourceGroupName : resourcegroup01
ServerName : server02
Location : West US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server02.database.windows.net
This command gets information about all the Azure SQL Database servers assigned to the resource group ResourceGroup01 that start with "server".
Example 5: Get all instances of SQL Server assigned to a resource group with external administrator information
$val = Get-AzSqlServer -ResourceGroupName "ResourceGroup01" -ExpandActiveDirectoryAdministrator
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server01.database.windows.net
Administrators : Microsoft.Azure.Management.Sql.Models.ServerExternalAdministrator
ResourceGroupName : resourcegroup01
ServerName : server02
Location : West US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server02.database.windows.net
Administrators : Microsoft.Azure.Management.Sql.Models.ServerExternalAdministrator
$val.Administrators
AdministratorType : ActiveDirectory
PrincipalType : Group
Login : Dummy
Sid : df7667b8-f9fd-4029-a0e3-b43c75ce9538
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
AzureADOnlyAuthentication : True
AdministratorType : ActiveDirectory
PrincipalType : Group
Login : Dummy2
Sid : df7667b8-f9fd-4029-a0e3-b43c75ce9538
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
AzureADOnlyAuthentication : True
This command gets information about all the Azure SQL Database servers assigned to the resource group ResourceGroup01.
Example 6: Get information about an Azure SQL Database server with external administrator information
$val = Get-AzSqlServer -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ExpandActiveDirectoryAdministrator
ResourceGroupName : resourcegroup01
ServerName : server01
Location : Central US
SqlAdministratorLogin : adminLogin
SqlAdministratorPassword :
ServerVersion : 12.0
Tags :
Identity :
FullyQualifiedDomainName : server01.database.windows.net
Administrators : Microsoft.Azure.Management.Sql.Models.ServerExternalAdministrator
$val.Administrators
AdministratorType : ActiveDirectory
PrincipalType : Group
Login : Dummy
Sid : df7667b8-f9fd-4029-a0e3-b43c75ce9538
TenantId : 00001111-aaaa-2222-bbbb-3333cccc4444
AzureADOnlyAuthentication : True
This command gets information about the Azure SQL Database server named Server01.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-ExpandActiveDirectoryAdministrator
Expand Active Directory Administrator Information on the server.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
Specifies the name of the resource group to which servers are assigned.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | True |
| DontShow: | False |
Parameter sets
-ServerName
Specifies the name of the server that this cmdlet gets.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | True |
| DontShow: | False |
| Aliases: | Name |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
Outputs
AzureSqlServerModel
Related Links
Azure PowerShell
Feedback
Was this page helpful?
