动态创建的变量不会AzureResourceManagerTemplateDeployment@3
作为
overrideParameters
.
样本模板:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
resourceGroupName: '...'
storageAccountName: 'actualAccountName'
subscriptionId: '...'
location: '...'
steps:
- task: PowerShell@2
displayName: "Set AzurePipeline var 'sasToken' to 1234"
inputs:
targetType: 'inline'
script: |
$token = 1234;
Write-Host "##vso[task.setvariable variable=sasToken;]$token"
- task: PowerShell@2
displayName: "Testing that sasToken is set"
inputs:
targetType: 'inline'
script: |
Write-Host "Token is: $(sasToken)"
- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'AzureRMServiceConnection'
subscriptionId: '$(subscriptionId)'
action: 'Create Or Update Resource Group'
resourceGroupName: '$(resourceGroupname)'
location: $(location)
templateLocation: 'Linked artifact'
csmFile: 'azuretemplates/azuredeploy.json'
overrideParameters: >-
-appServiceTemplateUri https://$(storageAccountName).blob.core.windows.net/templates/linked-appservice-template.json?$(sasToken)
deploymentMode: 'Incremental'
如您所见,有一个override parameters
部分我尝试$sasToken
使用各种方式附加。
到目前为止,我已经尝试过:
- $(sasToken)
- ${{ 变量.sasToken }}
- $[ 变量.sasToken ]
这些都不起作用,而且sasToken
总是空的。
输出网址如下所示:
https://actualAccountName.blob.core.windows.net/templates/linked-appservice-template.json?$(sasToken)
注意$(storageAccountName
:) 被替换而$(sasToken)
没有被替换。
我究竟做错了什么?