Skip to content

Script to modify SQL VM ESU and license type#1487

Open
qingquanxu wants to merge 1 commit into
microsoft:masterfrom
qingquanxu:qixu/sqlvm-license-script
Open

Script to modify SQL VM ESU and license type#1487
qingquanxu wants to merge 1 commit into
microsoft:masterfrom
qingquanxu:qixu/sqlvm-license-script

Conversation

@qingquanxu

Copy link
Copy Markdown

Add script to modify Azure SQL VM license type and ESU policy

Summary

Adds a new PowerShell sample that sets or changes the SQL Server license type (PAYG, AHUB, DR) and/or enables/disables the ESU policy at scale across Azure SQL VMs (Microsoft.SqlVirtualMachine/sqlVirtualMachines). It is the Azure SQL VM counterpart of the existing modify-arc-sql-license-type.ps1 sample for Arc-enabled SQL Servers, reusing the same parameter conventions and reporting shape.

What's included

  • samples/manage/azure-sql-vm/modify-license-type/modify-azure-sql-vm-license-type.ps1
  • samples/manage/azure-sql-vm/modify-license-type/README.md

Key features

  • Flexible scoping: single subscription, list of subscriptions (CSV), resource group, single VM, or list of VMs (CSV); defaults to all accessible subscriptions for automation/runbook scenarios.
  • -ReportOnly mode for safe previews (CSV report + transcript, no writes).
  • Read-only detection of the four Azure portal SQL configuration prerequisites (SqlIaaSAgent extension version, system-assigned managed identity, Microsoft.AzureArcData RP registration, SQL Management mode = Full); informational only and never blocks updates.
  • Records Azure portal deep-links in the CSV for any unmet prerequisite.
  • Opt-in remediation switches: -FixManagedIdentity, -FixArcDataRp, -FixManagementMode.
  • Additional controls: -Force, -ExclusionTags, -TenantId, -UseManagedIdentity, -BatchSize.

Requirements

  • PowerShell 7.0+
  • Az modules: Az.Accounts, Az.SqlVirtualMachine, Az.Compute, Az.ResourceGraph
  • SQL Virtual Machine Contributor + Virtual Machine Contributor (or Contributor) on targeted resources

Testing

  • Validated with -ReportOnly across multiple subscriptions; confirmed prerequisite detection and CSV deep-links.

Notes

  • No existing files modified; additive change only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant