Azure / Azure/static-web-apps

AzureStaticWebApp@0 - Unable to runtime variable for azure_static_web_apps_api_token

Open
#635 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Unable to pass the deployment token as a parameter when using a runtime variable

for the tasks below, "./artifacts/build/" is a built reactjs site, and "./artifacts/api/" is a function app. When "deploymentToken" is defined as a library or pipeline variable the site deploys fine, but when it is retrieved from the resource on-the-fly using the azure cli, deployment fails with an "invalid token" error. The value of $(deploymentToken) is the same as the value provided when you manage tokens in the Azure Portal. I verified this in both the Azure CLI and by writing the value to the log during deployment.

- task: AzureCLI@2
displayName: Get Deployment Key Variable
inputs:
azureSubscription: ******
scriptLocation: inlineScript
scriptType: pscore
inlineScript: |
$KEY= & az staticwebapp secrets list `
--name $(resource_group_name)_client `
--resource-group $(resource_group_name) `
--query properties.apiKey; `
Write-Host "##vso[task.setvariable variable=deploymentToken;issecret=true]$KEY"

- task: AzureStaticWebApp@0
displayName: Deploy Public Client
inputs:
app_location: "./artifacts/build/"
api_location: "./artifacts/api/"
azure_static_web_apps_api_token: $(deploymentToken)
output_location: ""
skip_app_build: true

**Expected behavior**
The token should be accepted and the deployment succeed, just as when using a compile time variable

**Screenshots**
![image](https://user-images.githubusercontent.com/22827246/142035712-a1274dc4-9bce-4687-8f15-f5f7933bf8b0.png)

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.