Add warning/exit for Az.Resources 5.3.0 service principal provisioning error (#3343)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
parent
d2fd862ce1
commit
5049b8f615
@ -143,6 +143,14 @@ function Retry([scriptblock] $Action, [int] $Attempts = 5)
|
||||
# https://azure.microsoft.com/en-us/updates/update-your-apps-to-use-microsoft-graph-before-30-june-2022/
|
||||
function NewServicePrincipalWrapper([string]$subscription, [string]$resourceGroup, [string]$displayName)
|
||||
{
|
||||
if ((Get-Module Az.Resources).Version -eq "5.3.0") {
|
||||
# https://github.com/Azure/azure-powershell/issues/17040
|
||||
# New-AzAdServicePrincipal calls will fail with:
|
||||
# "You cannot call a method on a null-valued expression."
|
||||
Write-Warning "Az.Resources version 5.3.0 is not supported. Please update to >= 5.3.1"
|
||||
Write-Warning "Update-Module Az.Resources -RequiredVersion 5.3.1"
|
||||
exit 1
|
||||
}
|
||||
$servicePrincipal = Retry {
|
||||
New-AzADServicePrincipal -Role "Owner" -Scope "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName" -DisplayName $displayName
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user