1

I am using Azure CLI command to deploy function code from a ZIPped artifact. Here is the code, nothing major just an az command and the location of the artifact.

az functionapp deployment source config-zip -g $RGName -n $FnName --src "$(System.DefaultWorkingDirectory)/_Artifacts/drop/EventHubFunction.zip"

However, when I am using that in a pipeline, I get a random non fatal error; i.e. the pipeline does throw an error, but it silently continues and the function gets deployed. I am just curious to know what this error means and what can I do to avoid this. The error I am faced with is,

2019-04-18T13:00:17.7925065Z ##[error]WARNING: Getting scm site credentials for zip deployment

2019-04-18T13:00:20.7587414Z ##[error]WARNING: Starting zip deployment

2019-04-18T13:00:20.7633968Z ##[error]

Please Note, I am using an Azure Powershell Task, using az login using a service principal and then using az functionapp deployment. I could use Azure CLI task I know, but my logic is a bit more complicated to extract the FnName, as I need to loop through and deploy several instances of the function and Azure CLI task does not like foreach

1
  • Can you try with --debug to get more info related to the error. Commented Apr 23, 2019 at 7:44

1 Answer 1

0

In regular Powershell commands you can use the CommonParameter -ErrorAction Stop But for the AzureCli az command i think you can use a simple if statement:

if (az login --service-principal -u $ClientId -p $ClientSecret --tenant $TenantId)
{
   "Success"
}
     else {"Error"}

Or check the last exit state using the $? Automatic variable after the login attempt:

if (!$?) {"Error"}

similarly for function deployment too, you can achieve it.Also try using the --query operator to check for things you need.E.g.

# Create the Web App if it does not already exist
if(-Not (az webapp show --name $webAppName --resource-group $resourceGroupName))
{
    az webapp create --name $webAppName --resource-group $resourceGroupName --plan $servicePlanName --tags 'displayName=WebApp'
}

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.