Azure CLI DevOps deploy fails with exit code: 1

Nibbler 616 Reputation points
2023-04-27T07:43:36.3966667+00:00

Hi Q&A,

Im having issues with deploying Azure CLI scrips in DevOps. And the only error that im getting is “2023-04-27T07:15:49.8277936Z ##[error]Script failed with exit code: 1”

The script I’m trying to initiate is to change the tier on app service plans, as shown below

{Set-AzAppServicePlan -Name 'app-service-plan' -ResourceGroupName resource-hroupå-name' -Tier PremiumV3 -NumberofWorkers 1 -WorkerSize 'medium'}

And a purge on the Front Door

Clear-AzFrontDoorCdnEndpointContent -EndpointName this-is-my-endpoint -ProfileName  front-door-name -ResourceGroupName resource-group-name -ContentPath "/" -AsJob*

I have tried running the pipeline as "powershell" and "batch. And alos added/removed the "start-job -ScriptBlock" from the scrips... error is the same.

I have also attached screendumpsScreen01-scale-step

Screen01-purge-step

error

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
301 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,053 questions
0 comments No comments
{count} votes

Accepted answer
  1. David Pazdera 316 Reputation points
    2023-04-27T12:38:17.3466667+00:00

    Hi,

    I have a couple of suggestions for you:

    • Try switching to Azure PowerShell task instead. You are using PowerShell cmdlets, not Az CLI commands
    • The screenshot indicates your issue might be related to wrong or missing 'Service Connection' that should be selected in 'Azure Resource Manager connection' field.
    • Ensure that the Service Principle being used by your DevOps pipeline has correct RBAC permissions / role assignment on Azure to provision the resources you need.

    Hope it helps.


1 additional answer

Sort by: Most helpful
  1. Limitless Technology 43,931 Reputation points
    2023-04-27T14:33:35.9+00:00

    Hello there,

    Is there anything in the deployment logs?

    Exit Code 1 means that a container terminated, typically due to an application error or an invalid reference. An application error is a programming error in any code running within the container.

    Similar discussion here

    https://github.com/microsoft/azure-pipelines-tasks/issues/12164

    Hope this resolves your Query !!

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments