Azure SQL Database is a strong, scalable, and cloud-based relational database service provided by Microsoft Azure. Managing these databases effectively in a big group could be difficult. Protecting monitor of Azure SQL Servers, their configurations, and utilization is essential for efficient administration. PowerShell could be your ally on this job, serving to you automate the method of producing reviews on Azure SQL Servers in your group.
On this weblog put up, I’m sharing a PowerShell script that generates a complete report on Azure SQL Servers inside your group throughout a number of subscriptions.
Conditions for this Answer:
Obtain the script from Git or PowerShell gallery from beneath hyperlinks:
Git:
https://github.com/VikasSukhija/Downloads
CloudAzureSQLServerDataBaseReport.ps1
PowerShell Gallery:
https://www.powershellgallery.com/packages/CloudAzureSQLServerDataBaseReport
Set up-Script -Identify CloudAzureSQLServerDataBaseReport
Replace the beneath part of the script with your individual parameters:
Notice: Script will auto generate encrypted password first time it’s run and reserve it in the identical folder as proven in beneath screenshot.
Report can be generated and ship on the e-mail id specified and saved in reviews folder.
Logic of the script:
It first makes use of Azure Graph Question to fetch all of the Subscriptions that host SQL servers.
After that it loops via every subscription and get the related details about the hosted SQL server in order that report could be generated.
Right here is the pattern report:
After operating it for first time interactively you possibly can schedule it to run by way of job scheduler as password has been saved as encrypted credentials contained in the script folder.
Notice: In case your group, MFA is enabled and its doesn’t work then it’s good to change the authentication piece to make use of app-based auth. (service principal auth)
Thanks for studying and downloading…
Tech Wizard