Azure / Azure/azure-cli-dev-tools

az functionapp show consistently fails the first time

Open
#546 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
91
Forks
134
Avg merge
2h 51m
Merged PRs (30d)
1

Description

As per the title.

Specifically:
Running a yaml pipeline in Azure Devops

modified example below.

```yaml
- task: AzureCLI@2
displayName: 'Get function urls and keys'
inputs:
azureSubscription: 'xyz'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
Write-Host "rgName: $(rgName)"
Write-Host "functionAppName: $(functionAppName)"
$statusUrl = az functionapp function show --resource-group $(rgName) --name $(functionAppName) --function-name 'status' --query 'invokeUrlTemplate'
Write-Host "##vso[task.setvariable variable=statusUrl]$($statusUrl.Trim('"'))"
```

Specifically any such code like the above always fails the first time after the referenced function is deployed. It seems to work reliably and successfully every other time after.

Do I need to write a sleep loop to address this? :(

**Actual Result**
```
ERROR: (NotFound) Error retrieving function.
Code: NotFound
Message: Error retrieving function.
You cannot call a method on a null-valued expression.
At /home/vsts/work/_temp/azureclitaskscript1681431997529_inlinescript.ps1:8 char:57
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvokeMethodOnNull
##[error]Script failed with exit code: 1
````

**Expected result:**
$statusUrl has a non-null value and the script executes as expected.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.