File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -356,7 +356,7 @@ public static int hashForArtifact(String artifact)
356
356
if ($CloudEnvironMent -eq " AzureUSGovernment" ) {
357
357
$HyperVManagerAppId = " AFAE2AF7-62E0-4AA4-8F66-B11F74F56326"
358
358
}
359
- $hyperVManagerObject = Get-AzADServicePrincipal - ApplicationID $HyperVManagerAppId
359
+ $hyperVManagerObject = Get-AzADServicePrincipal - ApplicationID $HyperVManagerAppId
360
360
$accessPolicies = @ ()
361
361
$userAccessPolicy = @ {
362
362
" tenantId" = $tenantID ;
@@ -449,7 +449,24 @@ public static int hashForArtifact(String artifact)
449
449
# RoleAssignments
450
450
451
451
$roleDefinitionId = " 81a9662b-bebf-436f-a333-f67b29880f12"
452
- $kvspnid = (Get-AzADServicePrincipal - DisplayName " Azure Key Vault" )[0 ].Id
452
+ $kvspnid = Get-AzADServicePrincipal - DisplayName " Azure Key Vault"
453
+ $Id = " "
454
+ if ($kvspnid -ne $null ){
455
+ $type = $kvspnid.GetType ().BaseType
456
+ Write-Host $type.Name
457
+ if ($type.Name -eq " Array" ){
458
+ $Id = $kvspnid [0 ].Id
459
+ }
460
+ else {
461
+ $Id = $kvspnid.Id
462
+ }
463
+ }
464
+ else {
465
+ Write-Host " Unable to retrieve KV SPN Id"
466
+ }
467
+ Write-Host $Id
468
+
469
+ $kvspnid = $Id
453
470
$gwyStorageAccount = Get-AzResource - ResourceName $GateWayStorageAcName - ResourceGroupName $ResourceGroupName
454
471
$lsaStorageAccount = Get-AzResource - ResourceName $LogStorageAcName - ResourceGroupName $ResourceGroupName
455
472
$gwyRoleAssignments = Get-AzRoleAssignment - ObjectId $kvspnid - Scope $gwyStorageAccount.Id - ErrorVariable notPresent - ErrorAction SilentlyContinue
You can’t perform that action at this time.
0 commit comments