Skip to content

Add custom Azure Policy and scripts for Arc-enabled SQL Server license type configuration#1475

Merged
anosov1960 merged 1 commit intomicrosoft:masterfrom
claestom:sql-arc-lt-policy
Apr 3, 2026
Merged

Add custom Azure Policy and scripts for Arc-enabled SQL Server license type configuration#1475
anosov1960 merged 1 commit intomicrosoft:masterfrom
claestom:sql-arc-lt-policy

Conversation

@claestom
Copy link
Copy Markdown
Contributor

@claestom claestom commented Apr 2, 2026

Summary

Adds a custom Azure Policy (DeployIfNotExists) with deployment and remediation scripts to enforce a target LicenseType on Arc-enabled SQL Server extensions at scale.

What's included

Path Description
policy/azurepolicy.json Custom policy definition supporting both Windows and Linux Arc SQL extensions, configurable target license type, and selective overwrite of existing values.
scripts/deployment.ps1 Creates/updates the policy definition and assignment at management group or subscription scope. Automatically assigns required RBAC roles to the policy managed identity.
scripts/start-remediation.ps1 Starts a remediation task for the assignment with optional -GrantMissingPermissions to fix missing roles before execution.
docs/screenshots/ Visual references showing pre-policy, remediation, and post-policy state.
README.md Full usage guide with parameter reference, scenario examples, and troubleshooting.

Key capabilities

  • Platform flexibility: target Windows, Linux, or both Arc SQL extensions with a single policy definition.
  • Selective overwrite: choose which existing LicenseType values (Unspecified, Paid, PAYG, LicenseOnly) are eligible for update.
  • Automated RBAC: deployment script assigns Azure Extension for SQL Server Deployment, Reader, and Resource Policy Contributor roles to the policy managed identity automatically.
  • Safe remediation: remediation script validates the assignment exists and checks for missing roles before creating the remediation task.

Example usage

# Deploy: enforce PAYG on both platforms, only where current LicenseType is Paid
.\scripts\deployment.ps1 -ManagementGroupId "<mg-id>" -SubscriptionId "<sub-id>" -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")

# Remediate: trigger remediation with automatic role check
.\scripts\start-remediation.ps1 -ManagementGroupId "<mg-id>" -SubscriptionId "<sub-id>" -TargetLicenseType "PAYG" -GrantMissingPermissions

Add new DeployIfNotExists policy, deployment and remediation scripts,
and documentation screenshots for enforcing LicenseType on Arc-enabled
SQL Server extensions.

New files:
- policy/azurepolicy.json: custom policy definition
- scripts/deployment.ps1: policy definition and assignment creation
- scripts/start-remediation.ps1: remediation task with role checks
- docs/screenshots/: visual references

Updated README paths for sql-server-samples repo structure.
Removed old flat policy files (params.json, policy.json, rules.json)
replaced by the new structured layout.
@anosov1960 anosov1960 merged commit 6c6eba3 into microsoft:master Apr 3, 2026
1 check passed
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.

2 participants