@@ -99,16 +99,16 @@ Image Builder will use the [user-identity](https://docs.microsoft.com/azure/acti
99
99
# setup role def names, these need to be unique
100
100
$timeInt=$(get-date -UFormat "%s")
101
101
$imageRoleDefName="Azure Image Builder Image Def"+$timeInt
102
- $idenityName ="aibIdentity"+$timeInt
102
+ $identityName ="aibIdentity"+$timeInt
103
103
104
104
## Add AZ PS module to support AzUserAssignedIdentity
105
105
Install-Module -Name Az.ManagedServiceIdentity
106
106
107
107
# create identity
108
- New-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $idenityName
108
+ New-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName
109
109
110
- $idenityNameResourceId =$(Get-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $idenityName ).Id
111
- $idenityNamePrincipalId =$(Get-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $idenityName ).PrincipalId
110
+ $identityNameResourceId =$(Get-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName ).Id
111
+ $identityNamePrincipalId =$(Get-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName ).PrincipalId
112
112
```
113
113
114
114
@@ -131,7 +131,7 @@ Invoke-WebRequest -Uri $aibRoleImageCreationUrl -OutFile $aibRoleImageCreationPa
131
131
New-AzRoleDefinition -InputFile ./aibRoleImageCreation.json
132
132
133
133
# grant role definition to image builder service principal
134
- New-AzRoleAssignment -ObjectId $idenityNamePrincipalId -RoleDefinitionName $imageRoleDefName -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup"
134
+ New-AzRoleAssignment -ObjectId $identityNamePrincipalId -RoleDefinitionName $imageRoleDefName -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup"
135
135
136
136
### NOTE: If you see this error: 'New-AzRoleDefinition: Role definition limit exceeded. No more role definitions can be created.' See this article to resolve:
137
137
https://docs.microsoft.com/azure/role-based-access-control/troubleshooting
@@ -202,7 +202,7 @@ Invoke-WebRequest `
202
202
-replace '<region1>',$location | Set-Content -Path $templateFilePath
203
203
(Get-Content -path $templateFilePath -Raw ) `
204
204
-replace '<region2>',$replRegion2 | Set-Content -Path $templateFilePath
205
- ((Get-Content -path $templateFilePath -Raw) -replace '<imgBuilderId>',$idenityNameResourceId ) | Set-Content -Path $templateFilePath
205
+ ((Get-Content -path $templateFilePath -Raw) -replace '<imgBuilderId>',$identityNameResourceId ) | Set-Content -Path $templateFilePath
206
206
```
207
207
208
208
@@ -316,19 +316,19 @@ Remove-AzResource -ResourceId $resTemplateId.ResourceId -Force
316
316
Delete role assignment
317
317
318
318
``` powerShell
319
- Remove-AzRoleAssignment -ObjectId $idenityNamePrincipalId -RoleDefinitionName $imageRoleDefName -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup"
319
+ Remove-AzRoleAssignment -ObjectId $identityNamePrincipalId -RoleDefinitionName $imageRoleDefName -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup"
320
320
```
321
321
322
322
remove definitions
323
323
324
324
``` powerShell
325
- Remove-AzRoleDefinition -Name "$idenityNamePrincipalId " -Force -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup"
325
+ Remove-AzRoleDefinition -Name "$identityNamePrincipalId " -Force -Scope "/subscriptions/$subscriptionID/resourceGroups/$imageResourceGroup"
326
326
```
327
327
328
328
delete identity
329
329
330
330
``` powerShell
331
- Remove-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $idenityName -Force
331
+ Remove-AzUserAssignedIdentity -ResourceGroupName $imageResourceGroup -Name $identityName -Force
332
332
```
333
333
334
334
delete the resource group.
0 commit comments