In below tasks , I'm unable to read the ouput from 1st task in 2nd task. The $objectId is not updating with the value. Any help on this ?
Set-AzKeyVaultAccessPolicy fails as objectId does not have valid value.
steps:
- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: ${{parameters.ServiceConnection}}
subscriptionId: $(azureSubscriptionId)
action: 'Create Or Update Resource Group'
resourceGroupName: $(loadTestResourceGroup)
location: '$(location)'
templateLocation: 'Linked artifact'
csmFile: '$(System.DefaultWorkingDirectory)/ARMTemplates/template.json'
csmParametersFile: '$(System.DefaultWorkingDirectory)/ARMTemplates/parameters.json'
overrideParameters: '-name $(loadTestResource) -location "$(location)" '
deploymentMode: 'Incremental'
deploymentOutputs: 'armOutputs'
- task: AzurePowerShell@5
displayName: Assign access policy
inputs:
azureSubscription: ${{parameters.ServiceConnection}}
scriptType: 'InlineScript'
Inline: |
$var= $env:armOutputs | ConvertFrom-Json
Write-Host "armOutputs:: $env:armOutputs"
Write-Host "json output:: $var"
$objectId=$var.azLoadTestResourceObjectID.value
Write-Host "ObjectID:: $objectId"
Set-AzKeyVaultAccessPolicy -VaultName $(keyvaultName) -ObjectId $objectId -PermissionsToSecrets get
azurePowerShellVersion: 'latestVersion'
pwsh: true