Bulk Register with SQL VM Resource Provider

Published Oct 25 2019 10:35 AM 4,365 Views
Microsoft

Many of you are running workloads on SQL Server on Azure Virtual Machines (SQL VM) today to leverage cloud agility, elasticity and scalability benefits. SQL VM differentiates by allowing full control on the OS, VM size, storage subsystem and offering free manageability services.  

 

If you choose to self-install SQL Server on Azure Virtual Machines instead of choosing a preconfigured SQL Server image from Azure Marketplace, you should register with SQL VM Resource Provider (SQL VM RP) for cost savings with simplified license management and free SQL Server manageability services like automated backup , automated High Availability with Always On AG, automated patching and performance optimized storage configuration.  

 

Today, we are enabling a new way of registering with SQL VM RP for customers running many SQL Server instances on Azure VMs. Bulk registering with SQL VM RP is using the new Azure power shell modules to automate registering with SQL VM RP for a list of subscriptions. 

 

Bulk Registration Script

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 uprunning Windows Server 2008 R2 and above and 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 mode with 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. 

 

Fully Customizable

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.

   #Retry options
    Set-Variable MAX_RETRIES -option ReadOnly -value 1
    $retryCount = 0
    $retryIfRequired = $false

 

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. 

Register-SqlVMs -Subscription SubscriptionId1 -ResourceGroupList ResourceGroup1

 

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.

 

register-SqlVMForSubscription -Subscription $Subscription -Credential $credential `
                -ResourceGroupName $ResourceGroupName -Name $Name

 

 

No billing impact

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.

 

Install the latest version of Az Module today and with a single command bulk register all VM’s running SQL with SQL VM RP to leverage the free manageability services and optimize your return of investment on Azure. 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-953955%22%20slang%3D%22en-US%22%3EBulk%20Register%20with%20SQL%20VM%20Resource%20Provider%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-953955%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EMany%20of%20you%20a%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ere%20running%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eworkloads%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20on%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fvirtual-machines%2Fsql-server%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ESQL%20Server%20on%20Azure%20Virtual%20Machines%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20(SQL%20VM)%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Etoday%20to%3C%2FSPAN%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3Eleverage%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecloud%20agility%2C%20elasticity%20and%20scalability%20benefits.%20SQL%20VM%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Edifferentiates%20by%20allowing%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Efull%20control%20on%20the%20OS%2C%20VM%20size%2C%20storage%20subsystem%20and%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eoffering%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-server-iaas-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Efree%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emanageability%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eservices%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E.%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EIf%20you%20choose%20to%20self-install%20SQL%20Server%20on%20Azure%20Virtual%20Machines%20instead%20of%20choosing%20a%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-server-iaas-overview%23get-started-with-sql-vms%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Epreconfigured%20SQL%20Server%20image%20from%20Azure%20Marketplace%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20you%20should%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-register-with-rp%3Fbranch%3Dpr-en-us-80472%26amp%3Btabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eregister%20with%20SQL%20VM%20Resource%20Provider%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20(SQL%20VM%20RP)%20for%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20cost%20savings%20with%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-ahb%3Ftabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Esimplified%20license%20management%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20and%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-server-iaas-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Efree%20SQL%20Server%20manageability%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eservices%3C%2FSPAN%3E%20%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3Elike%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-automated-backup-v2%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eautomated%20backup%20%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-availability-group-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eautomated%20High%20Availability%20with%20Always%20On%20AG%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-automated-patching%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eautomated%20patching%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20and%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Ftechcommunity.microsoft.com%252Ft5%252FSQL-Server%252FAnnouncing-Performance-Optimized-Storage-Configuration-for-SQL%252Fba-p%252F891583%26amp%3Bdata%3D02%257C01%257CMine.Tokus%2540microsoft.com%257Cce9ee2c00f1b48f232f208d75818a216%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637074735128459609%26amp%3Bsdata%3D%252BZQrFbjvhgNMChoHVPYCTYs13YcTVS9xaON54yIfB60%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eperformance%20optimized%20storage%20configuration%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-contrast%3D%22auto%22%3EToday%2C%20w%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-contrast%3D%22auto%22%3Ee%20are%20enabling%20a%20new%20way%20of%20registering%20with%20SQL%20VM%20RP%20for%20customers%20running%20many%20SQL%20Server%20instances%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-contrast%3D%22auto%22%3Eon%20Azure%20VMs.%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-bulk-register-with-resource-provider%3Fbranch%3Dpr-en-us-92680%26amp%3Btabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EBulk%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eregistering%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%20with%20SQL%20VM%20RP%3C%2FSPAN%3E%3C%2FA%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3Eis%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eusing%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethe%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.sqlvirtualmachine%2F%3Fview%3Dazps-2.8.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Enew%20Azure%20power%20shell%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emodules%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20to%20automate%20registering%20with%20SQL%20VM%20RP%20for%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ea%20list%20of%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esubscription%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Es%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1653187523%22%20id%3D%22toc-hId-1653187523%22%3E%3CSTRONG%3EBulk%20Registration%20Script%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-bulk-register-with-resource-provider%23full-script%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EBulk%20registration%20scrip%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Et%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20will%20iterate%20over%20all%20VM%E2%80%99s%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eowned%20by%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20the%20resource%20group%2C%20subscription%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bor%20list%20of%20VMs%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eprovided%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eas%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Einput%20and%20execute%20register%20with%20SQL%20VM%20RP%20command%20for%20all.%3C%2FSPAN%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3EIf%20the%20VM%20is%20up%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Erunning%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EWindows%20Server%202008%20R2%20and%20above%3C%2FSPAN%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3Eand%20had%20a%20SQL%20instance%2C%20then%20registration%20will%20be%20successful%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%26nbsp%3BAll%20failures%20are%20queued%20and%20retried%203%20times%20at%20the%20end%20of%20the%20first%20execution.%20R%3CSPAN%20data-contrast%3D%22auto%22%3Eegistration%20is%20always%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ein%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-register-with-resource-provider%3Fbranch%3Dpr-en-us-80472%26amp%3Btabs%3Dpowershell%23change-management-modes%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ELightweight%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emanagement%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emode%3C%2FSPAN%3E%3C%2FA%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3Ewith%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20no%20impact%20to%20SQL%20Server%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Einstance%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20or%20the%20VM%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eresources%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3ET%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehe%20lightweight%20agent%20will%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Es%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eimply%20verify%20the%20edition%20and%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eversion%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20of%20the%20instance%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20SQL%20server%20instance%20will%20not%20be%20restarted%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EBulk%20registration%20is%20a%20great%20way%20to%20report%20on%20your%20Azure%20VM%20assets.%20At%20the%20end%20of%20execution%2C%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-bulk-register-with-resource-provider%23output-description%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Et%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehe%20script%20will%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ecreate%20a%20detailed%20report%3C%2FSPAN%3E%20%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bincluding%26nbsp%3B%3CEM%3ETotal%20VMs%20Found%2C%20VMs%20Already%20registered%2C%20Number%20of%20VMs%20registered%20successfully%2C%20Number%20of%20VMs%20failed%20to%20register%20due%20to%20error%2C%20Number%20of%20VMs%20skipped%20as%20VM%20or%20the%20guest%20agent%20on%20VM%20is%20not%20running%20and%26nbsp%3BNumber%20of%20VMs%20skipped%20as%20they%20are%20not%20running%20SQL%20Server%20On%20Windows%3C%2FEM%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EBulk%20registration%20can%20be%20executed%20from%20any%20machine%20with%20latest%20Azure%20PowerShell%20or%20CLI%20environments.%20The%20account%20running%20the%20script%20should%20have%20%E2%80%9CVirtual%20Machine%20Contributor%2C%20Contributor%20or%20Owner%E2%80%9D%20permissions%20for%20the%20virtual%20machine%20being%20registered%20in%20one%20of%20the%20RBAC%20access%20levels.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--898969438%22%20id%3D%22toc-hId--898969438%22%3E%3CSTRONG%3EFully%20Customizable%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-sql%2Fvirtual-machines%2Fwindows%2Fsql-vm-resource-provider-bulk-register%23code-try-14%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EFull%20Script%3C%2FA%3E%20is%20available%20on%20GitHub%20with%20full%20documentation.%20You%20can%20use%20the%20script%20as%20is%20or%20customize%20the%20script%20to%20suit%20your%20asset's%20specific%20requirements.%20For%20example%2C%20you%20can%20disable%20the%20retry%20of%20failures%20to%20shorten%20the%20execution%20time%20by%20or%20reduce%20the%20retry%20time%20by%20updating%20parameter%20values%20as%20shown%20below.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%20%20%20%23Retry%20options%0A%20%20%20%20Set-Variable%20MAX_RETRIES%20-option%20ReadOnly%20-value%201%0A%20%20%20%20%24retryCount%20%3D%200%0A%20%20%20%20%24retryIfRequired%20%3D%20%24false%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20will%20run%20the%20bulk%20registration%20on%20a%20very%20large%20asset%2C%20to%20parallelize%20the%20execution%20and%20shorten%20completion%20time%20and%20you%20can%20run%20the%20script%20individually%20for%20each%20resource%20group%20or%20with%20a%20given%20list%20of%20VMs.%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ERegister-SqlVMs%20-Subscription%20SubscriptionId1%20-ResourceGroupList%20ResourceGroup1%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20use%20the%20script%20in%20report%20only%20mode%2C%20to%20assess%20the%20time%20to%20complete%20by%20removing%20the%20Registration%20call.%20For%20reporting%20only%20execution%2C%20please%20remove%20the%20calls%20below.%20Report%20only%20mode%20can%20show%20you%20total%20VM%20count%2C%20how%20many%20VMs%20are%20already%20registered%2C%20number%20of%20VMs%20will%20be%20skipped%20and%20target%20VM%20count%20for%20registration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Eregister-SqlVMForSubscription%20-Subscription%20%24Subscription%20-Credential%20%24credential%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-ResourceGroupName%20%24ResourceGroupName%20-Name%20%24Name%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-843840897%22%20id%3D%22toc-hId-843840897%22%3E%3CSTRONG%3ENo%20billing%20impact%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3ERunning%20Bulk%20registration%20script%20will%20not%20change%20anything%20on%20your%20current%20Azure%20Bill.%20It%20will%20read%26nbsp%3B%20the%20existing%20billing%20tags%20on%20the%20VMs%20as%20is.%26nbsp%3B%20If%20you%20created%20the%20VM%20from%20an%20Azure%20Marketplace%20SQL%20Server%20image%20with%20PAYG%20billing%20then%20it%20will%20continue%20as%20PAYG%20billing%20model.%20If%20you%20self-installed%20SQL%20Server%20on%20the%20VM%2C%20then%20it%20will%20be%20registered%20as%20AHB%20(Azure%20Hybrid%20Benefit)%20license%20model%20which%20tells%20that%20you%20are%20using%20existing%20on-premises%20SQL%20Sever%20licenses%20and%20Software%20Assurance%20to%20license%20that%20SQL%20Server%20instance.%20There%20is%20no%20license%20verification%20involved%20and%20License%20compliance%20is%20out%20of%20scope%20for%20SQL%20VM%20RP%20registration%20as%20it%20is%20owned%20by%20customer.%26nbsp%3BFree%20edition%20of%20SQL%20Server%20will%20be%20registered%20in%20PAYG%20mode%20and%20will%20not%20generate%20any%20SQL%20License%20bill.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fbs-latn-ba%2Fpowershell%2Fazure%2Finstall-az-ps%3Fview%3Dazps-2.8.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInstall%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ethe%20latest%20version%20of%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAz%20Module%20%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3Etoday%20and%20with%20a%20single%20command%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-machines%2Fwindows%2Fsql%2Fvirtual-machines-windows-sql-bulk-register-with-resource-provider%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ebulk%20register%20al%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3El%20VM%E2%80%99s%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20running%20SQL%20with%20SQL%20VM%20RP%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Et%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eo%20leverage%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSQL-Server%2FBenefit-from-Resource-Provider-registration-when-self-installing%2Fba-p%2F742794%22%20target%3D%22_blank%22%3E%3CSTRONG%3E%3CSPAN%20data-contrast%3D%22none%22%3Ethe%20free%20%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3CSPAN%20data-contrast%3D%22none%22%3Emanageability%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSTRONG%3E%3CSPAN%20data-contrast%3D%22none%22%3E%20services%20and%20optimize%20your%20return%20of%20investment%20on%20Azure%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FA%3E%3CSTRONG%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-953955%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-contrast%3D%22auto%22%3EToday%2C%20w%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-contrast%3D%22auto%22%3Ee%20are%20enabling%20a%20new%20way%20of%20registering%20with%20SQL%20VM%20RP%20for%20customers%20running%20many%20SQL%20Server%20instances%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-contrast%3D%22auto%22%3Eon%20Azure%20VMs.%20%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-contrast%3D%22none%22%3EBulk%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eregistering%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%20with%20SQL%20VM%20RP%3C%2FSPAN%3E%20%3CSPAN%20data-contrast%3D%22auto%22%3Eis%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eusing%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethe%20%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-%3CSPAN%20data-contrast%3D%22none%22%3Enew%20Azure%20power%20shell%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emodules%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%20to%20automate%20registering%20with%20SQL%20VM%20RP%20for%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ea%20list%20of%20%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esubscription%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Es%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2016px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-953955%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQLServerAzureVM%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jun 19 2020 10:01 AM
Updated by: