@@ -104,21 +104,19 @@ Use the following Azure PowerShell script to give a user Azure RBAC access to al
104
104
105
105
Import-Module Az.Accounts
106
106
Import-Module Az.Resources
107
-
107
+
108
108
Connect-AzAccount -Tenant <TenantId>
109
-
110
- $response = Invoke-AzRestMethod -Path /providers/Microsoft.Capacity/reservations?api-version=2020-06-01 -Method GET
111
-
109
+ $response = Invoke-AzRestMethod -Path /providers/Microsoft.BillingBenefits/savingsPlans?api-version=2022-11-01 -Method GET
112
110
$responseJSON = $response.Content | ConvertFrom-JSON
113
-
114
- $reservationObjects = $responseJSON.value
115
-
116
- foreach ($reservation in $reservationObjects)
111
+ $savingsPlanObjects = $responseJSON.value
112
+
113
+ foreach ($savingsPlan in $savingsPlanObjects)
117
114
{
118
- $reservationOrderId = $reservation .id.substring(0, 84)
119
- Write-Host "Assigning Owner role assignment to "$reservationOrderId
120
- New-AzRoleAssignment -Scope $reservationOrderId -ObjectId <ObjectId> -RoleDefinitionName Owner
115
+ $savingsPlanOrderId = $savingsPlan .id.substring(0, 84)
116
+ Write-Host "Assigning Owner role assignment to "$savingsPlanOrderId
117
+ New-AzRoleAssignment -Scope $savingsPlanOrderId -ObjectId <ObjectId> -RoleDefinitionName Owner
121
118
}
119
+
122
120
```
123
121
124
122
When you use the PowerShell script to assign the ownership role and it runs successfully, a success message isn’t returned.
@@ -161,7 +159,7 @@ Use the following Azure PowerShell script to add a Savings plan Administrator ro
161
159
Import-Module Az.Accounts
162
160
Import-Module Az.Resources
163
161
Connect-AzAccount -Tenant <TenantId>
164
- New-AzRoleAssignment -Scope "/providers/Microsoft.Capacity " -PrincipalId <ObjectId> -RoleDefinitionName "Savings plan Administrator"
162
+ New-AzRoleAssignment -Scope "/providers/Microsoft.BillingBenefits " -PrincipalId <ObjectId> -RoleDefinitionName "Savings plan Administrator"
165
163
```
166
164
167
165
#### Parameters
@@ -192,7 +190,7 @@ Import-Module Az.Resources
192
190
193
191
Connect-AzAccount -Tenant <TenantId>
194
192
195
- New-AzRoleAssignment -Scope "/providers/Microsoft.Capacity " -PrincipalId <ObjectId> -RoleDefinitionName "Savings plan Reader"
193
+ New-AzRoleAssignment -Scope "/providers/Microsoft.BillingBenefits " -PrincipalId <ObjectId> -RoleDefinitionName "Savings plan Reader"
196
194
```
197
195
198
196
#### Parameters
0 commit comments