vcpkg/scripts/azure-pipelines/android/setup-managed-identity.ps1
dan-shaw 5787cfa699
[vcpkg] Android CI support (#29406)
* initial

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix
2023-04-24 21:22:59 -07:00

17 lines
653 B
PowerShell

# Create a system managed identity
# Adding to existing Scale set
$scaleSetResourceGroup = "PrAnd-2023-04-17"
$scaleSetName = "PrAnd-2023-04-17Vmss"
$vm = Get-AzVMss -ResourceGroupName $scaleSetResourceGroup -Name $scaleSetName
Update-AzVMss -ResourceGroupName $scaleSetResourceGroup -VMScaleSetName $scaleSetName -IdentityType SystemAssigned
$spID = $vm.Identity.PrincipalId
$acrGroup = "And-Registry"
$acrName = "AndContainerRegistry"
$resourceID = (Get-AzContainerRegistry -ResourceGroupName $acrGroup -Name $acrName).Id
# needs admin privileges
New-AzRoleAssignment -ObjectId $spID -Scope $resourceID -RoleDefinitionName AcrPull