Skip to content

Commit bdc1ebf

Browse files
committed
Improve deployment and remediation README sections with variable setup
Restructure both Deploy Policy and Start Remediation usage instructions to guide users through setting variables before running scripts. Clearly separates required vs optional parameters with inline comments, shows progressively detailed invocations (minimal, with subscription, with all options), and streamlines scenario examples with descriptive comments.
1 parent 868cc27 commit bdc1ebf

1 file changed

Lines changed: 66 additions & 26 deletions

File tree

  • samples/manage/azure-arc-enabled-sql-server/compliance/arc-sql-license-type-compliance

samples/manage/azure-arc-enabled-sql-server/compliance/arc-sql-license-type-compliance/README.md

Lines changed: 66 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,38 +55,57 @@ curl -sLo scripts/start-remediation.ps1 "$baseUrl/scripts/start-remediation.ps1"
5555
Connect-AzAccount
5656
```
5757

58+
3. Set your variables. Only `TargetLicenseType` is required — all others are optional.
59+
5860
```powershell
59-
# Example: target both platforms (default), using tenant root management group
60-
.\scripts\deployment.ps1 -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")
61+
# ── Required ──
62+
$TargetLicenseType = "PAYG" # "Paid" or "PAYG"
63+
64+
# ── Optional (uncomment to override defaults) ──
65+
# $ManagementGroupId = "<management-group-id>" # Default: tenant root management group
66+
# $SubscriptionId = "<subscription-id>" # Default: policy assigned at management group scope
67+
# $ExtensionType = "Both" # "Windows", "Linux", or "Both" (default)
68+
# $LicenseTypesToOverwrite = @("Unspecified","Paid","PAYG","LicenseOnly") # Default: all
69+
```
6170

62-
# Example: target both platforms with explicit management group
63-
.\scripts\deployment.ps1 -ManagementGroupId "<management-group-id>" -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")
71+
4. Run the deployment.
6472

65-
# Example: target only Linux
66-
.\scripts\deployment.ps1 -ExtensionType "Linux" -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")
73+
```powershell
74+
# Minimal — uses defaults for management group, platform, and overwrite targets
75+
.\scripts\deployment.ps1 -TargetLicenseType $TargetLicenseType
76+
77+
# With subscription scope
78+
.\scripts\deployment.ps1 -TargetLicenseType $TargetLicenseType -SubscriptionId $SubscriptionId
79+
80+
# With all options
81+
.\scripts\deployment.ps1 `
82+
-ManagementGroupId $ManagementGroupId `
83+
-SubscriptionId $SubscriptionId `
84+
-ExtensionType $ExtensionType `
85+
-TargetLicenseType $TargetLicenseType `
86+
-LicenseTypesToOverwrite $LicenseTypesToOverwrite
6787
```
68-
The first example (without `-ExtensionType`) will:
69-
* Create/update a single policy definition and assignment covering **both** Windows and Linux.
70-
* Assign that policy at the specified subscription scope.
71-
* Enforce LicenseType = PAYG.
72-
* Update only resources where current `LicenseType` is `Paid`.
7388

74-
The second example creates a Linux-specific definition and assignment, with platform-tailored naming.
89+
This will:
90+
* Create/update the policy definition at the management group scope.
91+
* Create/assign the policy (at subscription scope when `-SubscriptionId` is provided, otherwise at management group scope).
92+
* Target the selected `ExtensionType` platform(s) — `Both` by default covers Windows and Linux.
93+
* Enforce the selected `TargetLicenseType` on resources matching the `LicenseTypesToOverwrite` filter.
7594

76-
Scenario examples:
95+
**Scenario examples:**
7796

7897
```powershell
79-
# Target Paid, both Linux and Windows, but only for resources with missing LicenseType or LicenseOnly (do not target PAYG)
80-
.\scripts\deployment.ps1 -TargetLicenseType "Paid" -LicenseTypesToOverwrite @("Unspecified","LicenseOnly")
98+
# Move all Paid licenses to PAYG, both platforms
99+
.\scripts\deployment.ps1 -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")
81100
82-
# Target PAYG, but only where current LicenseType is Paid (do not target missing or LicenseOnly)
83-
.\scripts\deployment.ps1 -ExtensionType "Linux" -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")
101+
# Set missing and LicenseOnly to Paid, skip resources already on PAYG
102+
.\scripts\deployment.ps1 -TargetLicenseType "Paid" -LicenseTypesToOverwrite @("Unspecified","LicenseOnly")
84103
85-
# Overwrite all known existing LicenseType values (Paid, PAYG, LicenseOnly), but not missing
86-
.\scripts\deployment.ps1 -ExtensionType "Linux" -TargetLicenseType "Paid" -LicenseTypesToOverwrite @("Paid","PAYG","LicenseOnly")
104+
# Linux only — move Paid to PAYG at a specific subscription
105+
.\scripts\deployment.ps1 -ExtensionType "Linux" -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -LicenseTypesToOverwrite @("Paid")
87106
```
88107

89-
Note: `scripts/deployment.ps1` automatically grants required roles to the policy assignment managed identity at assignment scope, preventing common `PolicyAuthorizationFailed` errors during DeployIfNotExists deployments.
108+
> **Note:** `deployment.ps1` automatically grants required roles to the policy assignment managed identity at assignment scope, preventing common `PolicyAuthorizationFailed` errors during DeployIfNotExists deployments.
90109
91110
## Start Remediation
92111

@@ -100,17 +119,38 @@ Parameter reference:
100119
| `TargetLicenseType` | Yes | N/A | `Paid`, `PAYG` | Must match the assignment target license type. |
101120
| `GrantMissingPermissions` | No | `false` | Switch (`present`/`not present`) | If set, checks and assigns missing required roles before remediation. |
102121

122+
1. Set your variables. `TargetLicenseType` is required and must match the value used during deployment — all others are optional.
123+
103124
```powershell
104-
# Example: remediate both platforms (default), using tenant root management group
105-
.\scripts\start-remediation.ps1 -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -GrantMissingPermissions
125+
# ── Required ──
126+
$TargetLicenseType = "PAYG" # Must match the deployment target
127+
128+
# ── Optional (uncomment to override defaults) ──
129+
# $ManagementGroupId = "<management-group-id>" # Default: tenant root management group
130+
# $SubscriptionId = "<subscription-id>" # Default: remediation runs at management group scope
131+
# $ExtensionType = "Both" # Must match the platform used for deployment
132+
```
106133

107-
# Example: remediate with explicit management group
108-
.\scripts\start-remediation.ps1 -ManagementGroupId "<management-group-id>" -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -GrantMissingPermissions
134+
2. Run the remediation.
109135

110-
# Example: remediate only Linux
111-
.\scripts\start-remediation.ps1 -ExtensionType "Linux" -SubscriptionId "<subscription-id>" -TargetLicenseType "PAYG" -GrantMissingPermissions
136+
```powershell
137+
# Minimal — uses defaults for management group and platform
138+
.\scripts\start-remediation.ps1 -TargetLicenseType $TargetLicenseType -GrantMissingPermissions
139+
140+
# With subscription scope
141+
.\scripts\start-remediation.ps1 -TargetLicenseType $TargetLicenseType -SubscriptionId $SubscriptionId -GrantMissingPermissions
142+
143+
# With all options
144+
.\scripts\start-remediation.ps1 `
145+
-ManagementGroupId $ManagementGroupId `
146+
-ExtensionType $ExtensionType `
147+
-SubscriptionId $SubscriptionId `
148+
-TargetLicenseType $TargetLicenseType `
149+
-GrantMissingPermissions
112150
```
113151

152+
> **Note:** Use `-GrantMissingPermissions` to automatically check and assign any missing required roles before remediation starts.
153+
114154
## Managed Identity And Roles
115155

116156
The policy assignment is created with `-IdentityType SystemAssigned`. Azure creates a managed identity on the assignment and uses it to apply DeployIfNotExists changes during enforcement and remediation.

0 commit comments

Comments
 (0)