Add Azure Policy to enforce Arc SQL Server license type#1469
Open
claestom wants to merge 1 commit intomicrosoft:masterfrom
Open
Add Azure Policy to enforce Arc SQL Server license type#1469claestom wants to merge 1 commit intomicrosoft:masterfrom
claestom wants to merge 1 commit intomicrosoft:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Add custom Azure Policy to standardize Arc-enabled SQL Server license type
What this policy does
This PR adds a custom Azure Policy definition (
sql-arc-license-configuration-policy.json) that targets Arc-enabled SQL Server extensions and enforces a configuredLicenseTypevalue in extension settings.Microsoft.HybridCompute/machines/extensionsWindowsAgent.SqlServerorLinuxAgent.SqlServer(configurable)DeployIfNotExists(default) orDisabledLicenseTypevalue.In practice, this helps keep Arc-enabled SQL Server licensing state consistent at scale.
How compliance is evaluated
The policy marks a resource as compliant when any of these conditions is true:
LicenseTypealready equals the configured target value (targetLicenseType), orLicenseTypeis missing andUnspecifiedis not included inlicenseTypesToOverwrite, orLicenseTypeis one ofPaid,PAYG, orLicenseOnlyand that value is not included inlicenseTypesToOverwrite.If none of the above apply, the resource is treated as non-compliant and the deployment sets
LicenseTypeto the target value.Parameters
effectDeployIfNotExistsDeployIfNotExists,DisabledsqlServerExtensionTypeWindowsAgent.SqlServerWindowsAgent.SqlServer,LinuxAgent.SqlServertargetLicenseTypePaidPaid,PAYGlicenseTypesToOverwrite['Unspecified','Paid','PAYG','LicenseOnly']Unspecified,Paid,PAYG,LicenseOnlyRBAC required for remediation
The policy includes these
roleDefinitionIdsfor remediation deployment:7392c568-9289-4bde-aaaa-b7131215889dacdd72a7-3385-48ef-bd42-f606fba81ae7At assignment time, the managed identity used by policy remediation must have permissions that allow updating Arc extension resources in scope.
Example scenarios
1) Enforce one value everywhere (strict standardization)
effect:DeployIfNotExiststargetLicenseType:PaidlicenseTypesToOverwrite:['Unspecified','Paid','PAYG','LicenseOnly']Outcome: All in-scope resources are driven to
LicenseType = Paid.2) Set only when missing (non-disruptive baseline)
effect:DeployIfNotExiststargetLicenseType:PaidlicenseTypesToOverwrite:['Unspecified']Outcome: Only resources where
LicenseTypeis missing are updated; existing explicit values are preserved.3) Migrate from Paid to PAYG, leave others untouched
effect:DeployIfNotExiststargetLicenseType:PAYGlicenseTypesToOverwrite:['Paid']Outcome: Only resources currently set to
Paidare updated toPAYG; missing and other states are left as-is.4) Linux-only rollout
sqlServerExtensionType:LinuxAgent.SqlServerOutcome: Policy applies only to Arc-enabled SQL Server Linux extension resources.
Notes for reviewers
evaluationDelay: AfterProvisioningSuccessto avoid acting before provisioning completes.incrementaland merges existing settings with the targetLicenseType, minimizing unrelated configuration changes.LicenseTypevalues (Paid/PAYG).