This article shows how to use the Azure Developer CLI (azd
) to create a CI/CD pipeline with Azure DevOps Pipelines (Azure Pipelines) for an azd
template. The pipeline enables you to push updates to a code repository and have your changes automatically provisioned and deployed to your Azure environment.
This example uses the Hello-AZD template, but you can follow these steps for any template that includes a pipeline definition file (found in the .github
or .azdo
folders).
In an empty directory, initialize the hello-azd
template:
azd init -t hello-azd
When prompted, enter a name for the environment (for example, hello-azd).
To use Azure Pipelines, you need an organization. Create one at https://dev.azure.com if you don't already have one.
Create a Personal Access Token (PAT)The Azure Developer CLI requires a Personal Access Token (PAT) to configure Azure Pipelines. Create a new PAT with the following scopes:
Run the following command to configure an Azure Pipelines project and repository with a deployment pipeline:
azd pipeline config --provider azdo
Respond to the prompts:
Personal Access Token (PAT):
Paste your PAT.
Optionally, export your PAT as a system environment variable to avoid repeated prompts:
export AZURE_DEVOPS_EXT_PAT=<PAT>
Azure Pipelines Organization Name:
.env
file for the current environment.A remote named "origin" was not found. Would you like to configure one?
How would you like to configure your project?
Enter the name for your new Azure Pipelines Project OR Hit enter to use this name: ( {default name} )
Would you like to commit and push your local changes to start the configured CI pipeline?
To verify the build, go to your project in the Azure Pipelines portal (https://dev.azure.com).
In the /src/components/pages
directory, open Home.razor
.
Change the Hello AZD!
header text to Hello, pipeline!
and save the file.
Create a branch and commit your change. The main
branch is protected, so push your changes from a new branch and create a Pull Request in Azure Pipelines. The pull request triggers the pipeline and blocks merging if the pipeline fails.
Approve and merge your pull request to start the pipeline again.
In your browser, open your project's repository to see your commit and the Azure Pipeline run.
Visit the web frontend URL to inspect the update.
azd
as an Azure Pipelines task
Add azd
as an Azure Pipelines task to install azd
in your pipeline. Add the following to .azdo/pipelines/azure-dev.yml
:
trigger:
- main
- branch
pool:
vmImage: ubuntu-latest
# vmImage: windows-latest
steps:
- task: setup-azd@0
displayName: Install azd
Clean up resources
When you no longer need the Azure resources created in this article, run:
azd down
Next steps
Monitor your app using Azure Developer CLI (azd)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4