Get Azure SQL server information using Powershell?

EnterpriseArchitect 5,376 Reputation points
2021-07-21T11:36:20.94+00:00

How can I get these information using the Azure Powershell module ?

Subscription
ResourceGrpName
SQLServerName
Region
SQLFQDN(*.database.windows.net)
SQLServerTLSVersion
SQLServerPublicNetworkAccess
SQLAdminLogin
SQLSrvAADEnabledStatus
SQLServerAPTStatus

By combining these:
https://learn.microsoft.com/en-us/powershell/module/az.sql/get-azsqlserver?view=azps-6.2.1
https://learn.microsoft.com/en-us/powershell/module/az.sql/get-azsqldatabase?view=azps-6.2.1
https://learn.microsoft.com/en-us/powershell/module/az.sql/get-azsqlserveractivedirectoryadministrator?view=azps-6.2.1

Thanks in advance.

SQL Server on Azure Virtual Machines
Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 19,176 Reputation points Microsoft Employee
    2021-07-23T18:10:33.85+00:00

    Hi @EnterpriseArchitect Thank you for posting your question.
    I don't think it is possible in one PowerShell script to get all information you listed above but you can try the following GetAzSqlServer -ResourceGroupName " " -ServerName " "

    117436-image.png
    The term SQLSrvAADEnabledStatus was not recognized as a name of commandlet, function or script file so I replaced it with Get-AzSqlServer -ServerName myserver | Get-AzSqlServerActiveDirectoryOnlyAuthentication

    117544-image.png

    Please let me know if this is not what you are looking for.

    Regards,
    Oury

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.