title | description | author | ms.author | ms.date | ms.service | ms.topic | ms.custom |
---|---|---|---|---|---|---|---|
Azure Developer CLI reference (preview) |
This article explains the syntax and parameters for the various Azure Developer CLI Preview commands. |
alexwolfmsft |
alexwolf |
01/11/2023 |
azure-dev-cli |
conceptual |
devx-track-azdevcli |
This article explains the syntax and parameters for the various Azure Developer CLI Preview commands.
Azure Developer CLI (azd
) is a command-line interface for developers who build Azure solutions.
To begin working with Azure Developer CLI, run the azd up
command by supplying a sample template in an empty directory:
azd up –-template todo-nodejs-mongo
You can pick a template by running azd template list
and then supplying the repo name as a value to --template
.
The most common next commands are:
azd pipeline config
azd deploy
azd monitor --overview
For more information, visit the Azure Developer CLI Dev Hub: https://aka.ms/azure-dev/devhub.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
-h, --help Gets help for azd.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config: Manage the Azure Developer CLI user configuration.
- azd deploy: Deploy the app's code to Azure.
- azd down: Delete Azure resources for an app.
- azd env: Manage environments.
- azd infra: Manage Azure resources.
- azd init: Initialize a new app.
- azd login: Log in to Azure.
- azd logout: Log out of Azure
- azd monitor: Monitor a deployed app.
- azd pipeline: Manage GitHub Actions or Azure Pipelines.
- azd provision: Provision the Azure resources for an app.
- azd restore: Restore app dependencies.
- azd template: Manage templates.
- azd up: Initialize the app, provision Azure resources, and deploy your project with a single command.
- azd version: Print the version number of Azure Developer CLI.
Manage the Azure Developer CLI user configuration.
Manage the Azure Developer CLI user configuration, which includes your default Azure subscription and location.
Available since azure-dev-cli_0.4.0-beta.1
.
The easiest way to configure azd
for the first time is to run azd init
. The subscription and location you select will be stored in the config.json
file located in the config directory. To configure azd
anytime afterwards, you'll use azd config set
.
The default value of the config directory is:
- $HOME/.azd on Linux and macOS
- %USERPROFILE%.azd on Windows
The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.
-h, --help Gets help for config.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config get: Gets a configuration
- azd config list: Lists all configuration values
- azd config reset: Resets configuration to default
- azd config set: Sets a configuration
- azd config unset: Unsets a configuration
- Back to top
Gets a configuration
Gets a configuration in the configuration path.
The default value of the config directory is:
$HOME/.azd
on Linux and macOS%USERPROFILE%\.azd
on Windows
The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.
azd config get <path> [flags]
-h, --help Gets help for get.
-o, --output string The output format (the supported formats are json). (default "json")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config: Manage the Azure Developer CLI user configuration.
- Back to top
Lists all configuration values
Lists all configuration values in the configuration path.
The default value of the config directory is:
$HOME/.azd
on Linux and macOS%USERPROFILE%\.azd
on Windows
The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.
azd config list [flags]
-h, --help Gets help for list.
-o, --output string The output format (the supported formats are json). (default "json")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config: Manage the Azure Developer CLI user configuration.
- Back to top
Resets configuration to default
Resets all configuration in the configuration path.
The default value of the config directory is:
$HOME/.azd
on Linux and macOS%USERPROFILE%\.azd
on Windows
The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable to the default.
azd config reset [flags]
-h, --help Gets help for reset.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config: Manage the Azure Developer CLI user configuration.
- Back to top
Sets a configuration
Sets a configuration in the configuration path.
The default value of the config directory is:
$HOME/.azd
on Linux and macOS%USERPROFILE%\.azd
on Windows
The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.
azd config set <path> <value> [flags]
azd config set defaults.subscription <yourSubscriptionID>
azd config set defaults.location eastus
-h, --help Gets help for set.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config: Manage the Azure Developer CLI user configuration.
- Back to top
Unsets a configuration
Removes a configuration in the configuration path.
The default value of the config directory is:
$HOME/.azd
on Linux and macOS%USERPROFILE%\.azd
on Windows
The configuration directory can be overridden by specifying a path in the AZD_CONFIG_DIR environment variable.
azd config unset <path> [flags]
azd config unset defaults.location
-h, --help Gets help for unset.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd config: Manage the Azure Developer CLI user configuration.
- Back to top
Deploy the app's code to Azure.
Deploy the app's code to Azure.
When no --service
value is specified, all services in the azure.yaml
file (found in the root of your project) are deployed.
Examples:
azd deploy
azd deploy --service api
azd deploy --service web
After the deployment is complete, the endpoint is printed. To start the service, select the endpoint or paste it in a browser.
azd deploy [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for deploy.
-o, --output string The output format (the supported formats are json, none). (default "none")
--service string Deploys a specific service (when the string is unspecified, all services that are listed in the azure.yaml file are deployed).
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Delete Azure resources for an app.
azd down [flags]
-e, --environment string The name of the environment to use.
--force Does not require confirmation before it deletes resources.
-h, --help Gets help for down.
-o, --output string The output format (the supported formats are json, none). (default "none")
--purge Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Manage environments.
Manage environments.
With this command group, you can create a new environment or get, set, and list your app environments. An app can have multiple environments (for example, dev, test, prod), each with a different configuration (that is, connectivity information) for accessing Azure resources.
You can find all environment configurations under the .azure\<environment-name>
directories. The environment name is stored as the AZURE_ENV_NAME environment variable in the .azure\<environment-name>\directory\.env
file.
-h, --help Gets help for env.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env get-values: Get all environment values.
- azd env list: List environments.
- azd env new: Create a new environment.
- azd env refresh: Refresh environment settings by using information from a previous infrastructure provision.
- azd env select: Set the default environment.
- azd env set: Set a value in the environment.
- Back to top
Get all environment values.
azd env get-values [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for get-values.
-o, --output string The output format (the supported formats are json, dotenv). (default "dotenv")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env: Manage environments.
- Back to top
List environments.
azd env list [flags]
-h, --help Gets help for list.
-o, --output string The output format (the supported formats are json, table). (default "table")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env: Manage environments.
- Back to top
Create a new environment.
azd env new <environment> [flags]
-h, --help Gets help for new.
-l, --location string Azure location for the new environment
--subscription string Name or ID of an Azure subscription to use for the new environment
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env: Manage environments.
- Back to top
Refresh environment settings by using information from a previous infrastructure provision.
azd env refresh [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for refresh.
-o, --output string The output format (the supported formats are json, none). (default "none")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env: Manage environments.
- Back to top
Set the default environment.
azd env select <environment> [flags]
-h, --help Gets help for select.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env: Manage environments.
- Back to top
Set a value in the environment.
azd env set <key> <value> [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for set.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd env: Manage environments.
- Back to top
Manage Azure resources.
-h, --help Gets help for infra.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd infra create: Create Azure resources for an app.
- azd infra delete: Delete Azure resources for an app.
- Back to top
Create Azure resources for an app.
azd infra create [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for create.
--no-progress Suppresses progress information.
-o, --output string The output format (the supported formats are json, none). (default "none")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd infra: Manage Azure resources.
- Back to top
Delete Azure resources for an app.
azd infra delete [flags]
-e, --environment string The name of the environment to use.
--force Does not require confirmation before it deletes resources.
-h, --help Gets help for delete.
--purge Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd infra: Manage Azure resources.
- Back to top
Initialize a new app.
Initialize a new app.
When no template is supplied, you can optionally select an Azure Developer CLI template for cloning. Otherwise, azd init
initializes the current directory and creates resources so that your project is compatible with Azure Developer CLI.
When a template is provided, the sample code is cloned to the current directory.
azd init [flags]
-b, --branch string The template branch to initialize from.
-e, --environment string The name of the environment to use.
-h, --help Gets help for init.
-l, --location string Azure location for the new environment
--subscription string Name or ID of an Azure subscription to use for the new environment
-t, --template string The template to use when you initialize the project. You can use Full URI, <owner>/<repository>, or <repository> if it's part of the azure-samples organization.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Log in to Azure.
Log in to Azure.
When run without any arguments, log in interactively using a browser. To log in using a device code, pass --device-code.
To log in as a service principal, pass --client-id and --tenant-id as well as one of --client-secret, --client-certificate, --client-credential or --client-credential-provider.
azd login [flags]
--check-status Checks the log-in status instead of logging in.
--client-certificate string The path to the client certificate for the service principal to authenticate with.
--client-id string The client id for the service principal to authenticate with.
--client-secret string The client secret for the service principal to authenticate with. Set to the empty string to read the value from the console.
--federated-credential string The federated token for the service principal to authenticate with. Set to the empty string to read the value from the console.
--federated-credential-provider string The provider to use to acquire a federated token to authenticate with.
-h, --help Gets help for login.
-o, --output string The output format (the supported formats are json, none). (default "none")
--redirect-port int Choose the port to be used as part of the redirect URI during interactive login.
--tenant-id string The tenant id for the service principal to authenticate with.
--use-device-code When true, log in by using a device code instead of a browser. (default true)
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Log out of Azure
Log out of Azure
azd logout [flags]
-h, --help Gets help for logout.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Monitor a deployed app.
Monitor a deployed app.
Examples:
azd monitor --overview
azd monitor -–live
azd monitor --logs
For more information, go to https://aka.ms/azure-dev/monitor.
azd monitor [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for monitor.
--live Open a browser to Application Insights Live Metrics. Live Metrics is currently not supported for Python apps.
--logs Open a browser to Application Insights Logs.
--overview Open a browser to Application Insights Overview Dashboard.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Manage GitHub Actions or Azure Pipelines.
Manage GitHub Actions or Azure Pipelines.
The Azure Developer CLI template includes a GitHub Actions and an Azure Pipeline configuration file in the .github/workflows
and .azdo/pipelines
directories respectively. The configuration file deploys your app whenever code is pushed to the main branch.
For more information, go to https://aka.ms/azure-dev/pipeline.
-h, --help Gets help for pipeline.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd pipeline config: Create and configure your deployment pipeline by using GitHub Actions or Azure Pipelines.
- Back to top
Create and configure your deployment pipeline by using GitHub Actions or Azure Pipelines.
Create and configure your deployment pipeline by using GitHub Actions or Azure Pipelines.
For more information, go to https://aka.ms/azure-dev/pipeline.
azd pipeline config [flags]
--auth-type string The authentication type used between the pipeline provider and Azure for deployment (Only valid for GitHub provider)
-e, --environment string The name of the environment to use.
-h, --help Gets help for config.
--principal-name string The name of the service principal to use to grant access to Azure resources as part of the pipeline.
--principal-role string The role to assign to the service principal. (default "contributor")
--provider string The pipeline provider to use (github for Github Actions and azdo for Azure Pipelines). (default "github")
--remote-name string The name of the git remote to configure the pipeline to run on. (default "origin")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd pipeline: Manage GitHub Actions or Azure Pipelines.
- Back to top
Provision the Azure resources for an app.
Provision the Azure resources for an app.
The command prompts you for the following values:
- Environment name: The name of your environment.
- Azure location: The Azure location where your resources will be deployed.
- Azure subscription: The Azure subscription where your resources will be deployed.
Depending on what Azure resources are created, running this command might take a while. To view progress, go to the Azure portal and search for the resource group that contains your environment name.
azd provision [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for provision.
--no-progress Suppresses progress information.
-o, --output string The output format (the supported formats are json, none). (default "none")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Restore app dependencies.
Restore app dependencies.
Run this command to download and install all the required libraries so that you can build, run, and debug the app locally.
For the best local run and debug experience, go to https://aka.ms/azure-dev/vscode to learn how to use the Visual Studio Code extension.
azd restore [flags]
-e, --environment string The name of the environment to use.
-h, --help Gets help for restore.
--service string Restores a specific service (when the string is unspecified, all services that are listed in the azure.yaml file are restored).
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Manage templates.
-h, --help Gets help for template.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd template list: List templates.
- azd template show: Show the template details.
- Back to top
List templates.
azd template list [flags]
-h, --help Gets help for list.
-o, --output string The output format (the supported formats are json, table). (default "table")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd template: Manage templates.
- Back to top
Show the template details.
azd template show <template> [flags]
-h, --help Gets help for show.
-o, --output string The output format (the supported formats are json, table). (default "table")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
- azd template: Manage templates.
- Back to top
Initialize the app, provision Azure resources, and deploy your project with a single command.
Initialize the project (if the project folder has not been initialized or cloned from a template), provision Azure resources, and deploy your project with a single command.
This command executes the following in one step:
azd init
azd provision
azd deploy
When no template is supplied, you can optionally select an Azure Developer CLI template for cloning. Otherwise, running azd up
initializes the current directory so that your project is compatible with Azure Developer CLI.
azd up [flags]
-b, --branch string The template branch to initialize from.
-e, --environment string The name of the environment to use.
-h, --help Gets help for up.
-l, --location string Azure location for the new environment
--no-progress Suppresses progress information.
-o, --output string The output format (the supported formats are json, none). (default "none")
--service string Deploys a specific service (when the string is unspecified, all services that are listed in the azure.yaml file are deployed).
--subscription string Name or ID of an Azure subscription to use for the new environment
-t, --template string The template to use when you initialize the project. You can use Full URI, <owner>/<repository>, or <repository> if it's part of the azure-samples organization.
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.
Print the version number of Azure Developer CLI.
azd version [flags]
-h, --help Gets help for version.
-o, --output string The output format (the supported formats are json, none). (default "none")
-C, --cwd string Sets the current working directory.
--debug Enables debugging and diagnostics logging.
--no-prompt Accepts the default value instead of prompting, or it fails if there is no default.