0
votes

I installed the preview release of the Azure DevOps CLI extension and verified its installation. I set some defaults using az devops configure --defaults organization=https://dev.azure.com/XXX project="XXX". I can trigger a release using az pipelines release create --definition-name "XXX". Based on that, it seems that my installation is good and I should be able to do what I'm attempting. BTW, I'm using the Cloud Shell in the Azure Portal for this but will eventually move my work to Azure CLI Tasks in classic Release Pipelines.

When I run the following:

az pipelines variable update --org https://dev.azure.com/XXX --project "XXX" --pipeline-name  "XXX" --name "var_name" --value "var_value"

I get the following message:

There were no build definitions matching name "XXX" in project "XXX".

And I get the same message when I run the following:

az pipelines variable list --org https://dev.azure.com/XXX--project "XXX" --pipeline-name  "XXX"

One problem, the message references build definitions. I didn't specify a build definition. It is a classic (pre-YAML) release definition and it definitely exists.

Should I be able to access and manipulate release pipeline variables using this extension? The extension's docs page makes no reference to build or release definitions.

1
How about the issue? Does the answer below resolved your question, If not, would you please let me know the latest information about this issue?Leo Liu-MSFT

1 Answers

0
votes

Thi CLI option is for pipelines not for releases. You can pick one of two possible workaraound.

  1. Use general command
az devops invoke --org https://dev.azure.com/thecodemanual/ --area release --resource definitions --http-method Put --route-parameters project="DevOps Manual" definitionId=7 --in-file 9.json --api-version 5.1  

in 9.json I have release definition get via this endpoint

https://vsrm.dev.azure.com/{{organization}}/{{project}}/_apis/release/definitions/7?api-version=6.1-preview.4

with modified variables section:

    "variables": {
        "ReleaseVersion": {
            "value": "Version-from-cli"
        }
    },

enter image description here

Please be aware that stage scope variables appears in stage definition scope.

  1. Use variable group and define there your variable and then use CLI from variables groups.
az pipelines variable-group variable update --group-id
                                            --name
                                            [--detect {false, true}]
                                            [--new-name]
                                            [--org]
                                            [--project]
                                            [--prompt-value {false, true}]
                                            [--secret {false, true}]
                                            [--value]