You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sync eng/common directory with azure-sdk-tools for PR 5242 (Azure#28508)
* Consolidate naming logic and generate short hash names for local use
* Shorten long lines
* Handle issues with EnvironmentVariable parameter ref being updated
* Warn on env variable overwrite. Base name generation off resource group
* Use SHA256 algorithm for short name hash
---------
Co-authored-by: Ben Broderick Phillips <[email protected]>
Log "Creating resource group '$ResourceGroupName' in location '$Location'"
@@ -592,16 +590,17 @@ try {
592
590
if ($resourceGroup.ProvisioningState-eq'Succeeded') {
593
591
# New-AzResourceGroup would've written an error and stopped the pipeline by default anyway.
594
592
Write-Verbose"Successfully created resource group '$($resourceGroup.ResourceGroupName)'"
595
-
}
596
-
elseif (!$resourceGroup) {
593
+
} elseif (!$resourceGroup) {
597
594
if (!$PSCmdlet.ShouldProcess($resourceGroupName)) {
598
595
# If the -WhatIf flag was passed, there will be no resource group created. Fake it.
599
596
$resourceGroup= [PSCustomObject]@{
600
597
ResourceGroupName=$resourceGroupName
601
598
Location=$Location
602
599
}
603
600
} else {
604
-
Write-Error"Resource group '$ResourceGroupName' already exists."-Category ResourceExists -RecommendedAction "Delete resource group '$ResourceGroupName', or overwrite it when redeploying."
601
+
Write-Error"Resource group '$ResourceGroupName' already exists."`
602
+
-Category ResourceExists `
603
+
-RecommendedAction "Delete resource group '$ResourceGroupName', or overwrite it when redeploying."
Write-Warning"The Object ID of the test application was unable to be queried. You may want to consider passing it explicitly with the 'TestApplicationOid` parameter."
655
+
Write-Warning"The Object ID of the test application was unable to be queried. "+`
656
+
"You may want to consider passing it explicitly with the 'TestApplicationOid` parameter."
654
657
throw$_.Exception
655
658
}
656
659
@@ -667,7 +670,11 @@ try {
667
670
# If the role hasn't been explicitly assigned to the resource group and a cached service principal is in use,
668
671
# query to see if the grant is needed.
669
672
if (!$resourceGroupRoleAssigned-and$AzureTestPrincipal) {
if ($principalOwnerAssignment.RoleDefinitionName-eq'Owner') {
683
694
Write-Verbose"Successfully assigned ownership of '$ResourceGroupName' to the Test Application '$TestApplicationId'"
684
695
} else {
685
-
Write-Warning"The 'Owner' role for '$ResourceGroupName' could not be assigned. You may need to manually grant 'Owner' for the resource group to the Test Application '$TestApplicationId' if it does not have subscription-level permissions."
696
+
Write-Warning"The 'Owner' role for '$ResourceGroupName' could not be assigned. "+`
697
+
"You may need to manually grant 'Owner' for the resource group to the "+`
698
+
"Test Application '$TestApplicationId' if it does not have subscription-level permissions."
686
699
}
687
700
}
688
701
@@ -773,7 +786,12 @@ try {
773
786
Write-Host"Deployment '$($deployment.DeploymentName)' has CorrelationId '$($deployment.CorrelationId)'"
774
787
Write-Host"Successfully deployed template '$($templateFile.jsonFilePath)' to resource group '$($resourceGroup.ResourceGroupName)'"
0 commit comments