Bulk registration script will iterate over all VM’s owned by the resource group, subscription or list of VMs provided as input and execute register with SQL VM RP command for all.If the VM is up, running Windows Server 2008 R2 and aboveand had a SQL instance, then registration will be successful. All failures are queued and retried 3 times at the end of the first execution. Registration is always in Lightweight management modewith no impact to SQL Server instance or the VM resources.The lightweight agent will simply verify the edition and version of the instance, SQL server instance will not be restarted.
Bulk registration is a great way to report on your Azure VM assets. At the end of execution, the script will create a detailed report including Total VMs Found, VMs Already registered, Number of VMs registered successfully, Number of VMs failed to register due to error, Number of VMs skipped as VM or the guest agent on VM is not running and Number of VMs skipped as they are not running SQL Server On Windows.
Bulk registration can be executed from any machine with latest Azure PowerShell or CLI environments. The account running the script should have “Virtual Machine Contributor, Contributor or Owner” permissions for the virtual machine being registered in one of the RBAC access levels.
Full Script is available on GitHub with full documentation. You can use the script as is or customize the script to suit your asset's specific requirements. For example, you can disable the retry of failures to shorten the execution time by or reduce the retry time by updating parameter values as shown below.
If you will run the bulk registration on a very large asset, to parallelize the execution and shorten completion time and you can run the script individually for each resource group or with a given list of VMs.
You can use the script in report only mode, to assess the time to complete by removing the Registration call. For reporting only execution, please remove the calls below. Report only mode can show you total VM count, how many VMs are already registered, number of VMs will be skipped and target VM count for registration.
Running Bulk registration script will not change anything on your current Azure Bill. It will read the existing billing tags on the VMs as is. If you created the VM from an Azure Marketplace SQL Server image with PAYG billing then it will continue as PAYG billing model. If you self-installed SQL Server on the VM, then it will be registered as AHB (Azure Hybrid Benefit) license model which tells that you are using existing on-premises SQL Sever licenses and Software Assurance to license that SQL Server instance. There is no license verification involved and License compliance is out of scope for SQL VM RP registration as it is owned by customer. Free edition of SQL Server will be registered in PAYG mode and will not generate any SQL License bill.