Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

Unable to run az pipelines create with the service connection parameter #25232

Open alexwhitmore opened 1 year ago

alexwhitmore commented 1 year ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Related command

az pipelines create `
    --name <name of pipeline> `
    --repository <name of repo> `
    --yml-path <path to file> `
    --folder-path <folder path to place pipeline> `
    --service-connection <connection name>

Describe the bug When running the az pipelines create command listed above without the service connection parameter, I am presented with:

Which service connection do you want to use to communicate with GitHub?
  [1] Create a new GitHub service connection
  [2] <connection name I want to use>
  [3] <org name>

When I type in 2 and press enter, the command finishes and the pipeline is now created in Azure DevOps.

However, I would like to run this command as part of a script that is non-interactive which means I need to use the --service-connection parameter. When I run the full command listed above in "Related command", I am presented with: Could not create service hooks subscription. The repository does not reference a service connection.

If the pipeline already exists I am presented with: Pipeline with name <pipeline name given> already exists.

To Reproduce With the source code in GitHub, and pipelines in Azure Devops, run az pipelines create with the same parameters used.

Expected behavior I would expect:

  1. Run the full command (with the service connection name).
  2. Without any interaction, the az cli commands finishes.
  3. The new pipeline is created in Azure DevOps.

Environment summary

yonzhan commented 1 year ago

route to CXP team

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @v-anvashist, @V-hmusukula.

Issue Details
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62 **Related command** ``` az pipelines create ` --name ` --repository ` --yml-path ` --folder-path ` --service-connection ``` **Describe the bug** When running the `az pipelines create` command listed above without the service connection parameter, I am presented with: ``` Which service connection do you want to use to communicate with GitHub? [1] Create a new GitHub service connection [2] [3] ``` When I type in 2 and press enter, the command finishes and the pipeline is now created in Azure DevOps. However, I would like to run this command as part of a script that is non-interactive which means I need to use the `--service-connection` parameter. When I run the full command listed above in "Related command", I am presented with: `Could not create service hooks subscription. The repository does not reference a service connection.` If the pipeline already exists I am presented with: `Pipeline with name already exists.` **To Reproduce** With the source code in GitHub, and pipelines in Azure Devops, run `az pipelines create` with the same parameters used. **Expected behavior** I would expect: 1. Run the full command (with the service connection name). 2. Without any interaction, the az cli commands finishes. 3. The new pipeline is created in Azure DevOps. **Environment summary** - Windows 10 Enterprise, OS build 19044 - Installer: MSI - Azure CLI: 2.43.0 - Extensions: azure-devops - 0.25.0 - Shell type: bash
Author: alexwhitmore
Assignees: -
Labels: `Service Attention`, `customer-reported`, `Installation`, `DevOps`, `Pipelines`, `Auto-Assign`
Milestone: Backlog
navba-MSFT commented 1 year ago

Adding the Service team to look at the devops issue.

@v-anvashist, @V-hmusukula Could you please look into this issue ? Thanks in advance.

richardswinbank commented 1 year ago

@alexwhitmore I had this same problem and noticed that the docs say that --service-connection is the "Id of the Service connection created for the repository for GitHub repository."

The user experience is misleading (because of the inconsistency with the interactive prompt), but using the service connection GUID enabled me to use the command successfully in a DevOps pipeline.