Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Azure DevOps Task(setup-azd) to todo templates #2642

Closed
rajeshkamal5050 opened this issue Aug 18, 2023 · 5 comments · Fixed by #2701
Closed

add Azure DevOps Task(setup-azd) to todo templates #2642

rajeshkamal5050 opened this issue Aug 18, 2023 · 5 comments · Fixed by #2701
Assignees
Labels
azdo Azure DevOps pipelines

Comments

@rajeshkamal5050
Copy link

rajeshkamal5050 commented Aug 18, 2023

Task

Reference - Similar to GHA setup-azd updates,

cc: @hemarina @vhvb1989

@vhvb1989
Copy link
Member

setupt-azd task for azdo is not a built-in extension.
Folks first need to install the extension within their devops org.

If we update our todo-templates, we need to add a note to the readme files about installing the extension before using the pipeline definition.

@zedy-wj
Copy link
Member

zedy-wj commented Aug 23, 2023

@vhvb1989 - When we try to remove references to usage of auth.useAzCliAuth from azdo pipelines, it seems that we need azd auth login step to replace it.
How do we configure relevant credentials, similar to that in github workflow as below:
image

@vhvb1989
Copy link
Member

Thank you @zedy-wj ,

We first need this PR: #2667
That would set the AZURE_CREDENTIALS secret the same way as github actions.
Note that we don't have support for federated-credential on azdo. Azd automatically changes to client-secret authentication when using azdo.

Once the PR is merged, the pipeline definition should look like:

# Run when commits are pushed to mainline branch (main or master)
# Set this to the mainline branch you are using
trigger:
  - main
  - master

# Azure Pipelines workflow to deploy to Azure using azd
# To configure required secrets for connecting to Azure, simply run `azd pipeline config --provider azdo`

pool:
  vmImage: ubuntu-latest

steps:
  - task: setup-azd@0
    displayName: Install azd

  - pwsh: |
      $info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
      
      azd auth login `
        --client-id "$($info.clientId)" `
        --client-secret "$($info.clientSecret)" `
        --tenant-id "$($info.tenantId)"
    displayName: azd login
    env:
      AZURE_CREDENTIALS: $(AZURE_CREDENTIALS)

  - pwsh: |
      azd provision --no-prompt
    displayName: Provision Infrastructure
    env:
      AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
      AZURE_ENV_NAME: $(AZURE_ENV_NAME)
      AZURE_LOCATION: $(AZURE_LOCATION)

  - pwsh: |
      azd deploy --no-prompt
    displayName: Deploy Application
    env:
      AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
      AZURE_ENV_NAME: $(AZURE_ENV_NAME)
      AZURE_LOCATION: $(AZURE_LOCATION)

@v-xuto
Copy link
Member

v-xuto commented Sep 4, 2023

@rajeshkamal5050 The PR for this issue is ready, please review.

@rajeshkamal5050
Copy link
Author

setup-azd task for azdo is not a built-in extension.
Folks first need to install the extension within their devops org.

@vhvb1989 can you review the PR for @v-xuto?

If there is a pre-requisite for the setup-azd task to be enabled in their org. Can we even make this as default in our templates?

cc @savannahostrowski @ellismg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azdo Azure DevOps pipelines
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants