I have an issue at PowerShell script for executing on pipeline at dev azure,
error is happening with message:
Start-Process : This command cannot be run due to the error: %1 is not a valid Win32 application
it was worked some time ago but now it is not, is it some updates were done on azure?
or I need to improve some code?
foreach ($alert in $alerts)
{
Write-Log "`tCreating alert $($alert.AlertName)"
$azArgs = "monitor metrics alert create --name ""$($alert.AlertName)"" --resource-group ""$($resourceGroup)"" --condition ""$($alert.AlertRule)"" --scopes ""$($alert.ResourceId)"" --window-size 5m --evaluation-frequency 1m --action ""$actionGroupResourceId"" --description "" "" --subscription ""$subscriptionId"" --auto-mitigate true"
Write-Verbose $azArgs
Start-Process "az" -ArgumentList $azArgs -NoNewWindow -Wait
}
2
Answers
issue is related to azure updates https://pullanswer.com/questions/error-with-startprocess-and-az-command
problem is Azure Cli has been updated and so now there is an az.ps1 so i need to make "az.cmd" in order to continue to call the good program...
AFAIK, the issue shows that you are not using X32 environment. so, that the error thrown. It is a common issue we cannot directly find out what exactly happens we can fix it by following
Ways to fix: