0
votes

I have a question regarding Azure DevOps, It seems it is not possible to set in pipeline's jobs Azure subscription field using variables. On attempt to do this I'm getting the error message:

The pipeline is not valid.

I was trying to use in variable:

  • Subscription ID
  • Service Connection Name
  • Service Connection ID

But with no luck - the same issue again and again. Since I need to change subscriptions for pipeline very often, it's very critical problem for me. Could you please elaborate the issue?

1
It's possible; I do it frequently. Are you using YAML pipelines or visual designer JSON pipelines?Daniel Mann
I'm using visual designer JSON pipelines.DariyN

1 Answers

1
votes

If you use YAML pipelines you could configure your subscription as variable as follows:

- task: AzureCLI@2
  inputs:
    azureSubscription: '$(SubscriptionId)'
    scriptType: 'ps'
    scriptLocation: 'inlineScript'
    inlineScript: |
      az --version
      az account show

Variable settings

And during every build you can override your azure subscription.