Azure Developer CLI 參考

本文說明各種 Azure 開發人員 CLI 命令的語法和參數。

azd

Azure 開發人員 CLI ( azd ) 是一種開放原始碼工具,可協助在 Azure 上上線和管理您的應用程式

選項。

  -C, --cwd string   Sets the current working directory.
      --debug        Enables debugging and diagnostics logging.
      --docs         Opens the documentation for azd in your web browser.
  -h, --help         Gets help for azd.
      --no-prompt    Accepts the default value instead of prompting, or it fails if there is no default.

另請參閱

  • azd auth :向 Azure 進行驗證。
  • azd config :管理 azd configurations (例如:預設 Azure 訂用帳戶,位置)。
  • azd deploy :將應用程式的程式碼部署至 Azure。
  • azd down :刪除應用程式的 Azure 資源。
  • azd env :管理環境。
  • azd hooks :開發、測試及執行應用程式的勾點。 (Beta)
  • azd init :初始化新的應用程式。
  • azd monitor :監視已部署的應用程式。 (Beta)
  • azd package :封裝要部署至 Azure 的應用程式程式碼。 (Beta)
  • azd pipeline :管理和設定您的部署管線。 (Beta)
  • azd provision :布建應用程式的 Azure 資源。
  • azd restore :還原應用程式的相依性。 (Beta)
  • azd show :顯示應用程式及其資源的相關資訊。
  • azd template :尋找和檢視範本詳細資料。 (Beta)
  • azd up :布建 Azure 資源,並使用單一命令部署您的專案。
  • azd version :列印 Azure 開發人員 CLI 的版本號碼。

azd auth

使用 Azure 進行驗證。

選項。

      --docs   Opens the documentation for azd auth in your web browser.
  -h, --help   Gets help for auth.

繼承自父命令的選項

  -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 auth login

登入 Azure。

概要

登入 Azure。

在沒有任何引數的情況下執行時,請使用瀏覽器以互動方式登入。 若要使用裝置程式碼登入,請傳遞 --use-device-code。

若要以服務主體身分登入,請傳遞 --client-id 和 --tenant-id,以及下列其中一個:--client-secret、--client-certificate 或 --federated-credential-provider。

azd auth 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.
      --docs                                   Opens the documentation for azd auth login in your web browser.
      --federated-credential-provider string   The provider to use to acquire a federated token to authenticate with.
  -h, --help                                   Gets help for login.
      --redirect-port int                      Choose the port to be used as part of the redirect URI during interactive login.
      --tenant-id string                       The tenant id or domain name to authenticate with.
      --use-device-code[=true]                 When true, log in by using a device code instead of a browser.

繼承自父命令的選項

  -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 auth logout

登出 Azure。

概要

登出 Azure

azd auth logout [flags]

選項。

      --docs   Opens the documentation for azd auth logout in your web browser.
  -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.

另請參閱

azd config

管理 azd configurations (例如:預設 Azure 訂用帳戶,位置)。

概要

管理 Azure 開發人員 CLI 使用者設定,其中包括您的預設 Azure 訂用帳戶和位置。

自 開始 azure-dev-cli_0.4.0-beta.1 提供。

第一次設定最簡單的方式 azd 是執行 azd init 。 您選取的 config.json 訂用帳戶和位置將會儲存在組態目錄中的檔案中。 若要在之後隨時設定 azd ,您將使用 azd config set

組態目錄的預設值為:

  • linux 和 macOS 上的 $HOME/.azd
  • Windows 上的 %USERPROFILE%.azd

您可以在 AZD_CONFIG_DIR 環境變數中指定路徑,以覆寫組態目錄。

選項。

      --docs   Opens the documentation for azd config in your web browser.
  -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

取得組態。

概要

取得組態路徑中的組態。

組態目錄的預設值為:

  • $HOME/.azd 在 Linux 和 macOS 上
  • %USERPROFILE%\.azd 在 Windows 上

您可以在 AZD_CONFIG_DIR 環境變數中指定路徑,以覆寫組態目錄。

azd config get <path> [flags]

選項。

      --docs   Opens the documentation for azd config get in your web browser.
  -h, --help   Gets help for get.

繼承自父命令的選項

  -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 list-Alpha

顯示 Alpha 階段中可用功能的清單。

azd config list-alpha [flags]

選項。

      --docs   Opens the documentation for azd config list-alpha in your web browser.
  -h, --help   Gets help for list-alpha.

繼承自父命令的選項

  -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 reset

將組態重設為預設值。

概要

重設組態路徑中的所有組態。

組態目錄的預設值為:

  • $HOME/.azd 在 Linux 和 macOS 上
  • %USERPROFILE%\.azd 在 Windows 上

您可以藉由將AZD_CONFIG_DIR環境變數中的路徑指定為預設值,來覆寫組態目錄。

azd config reset [flags]

選項。

      --docs    Opens the documentation for azd config reset in your web browser.
  -f, --force   Force reset without confirmation.
  -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 set

設定組態。

概要

設定組態路徑中的組態。

組態目錄的預設值為:

  • $HOME/.azd 在 Linux 和 macOS 上
  • %USERPROFILE%\.azd 在 Windows 上

您可以在 AZD_CONFIG_DIR 環境變數中指定路徑,以覆寫組態目錄。

azd config set <path> <value> [flags]

範例

azd config set defaults.subscription <yourSubscriptionID>
azd config set defaults.location eastus

選項。

      --docs   Opens the documentation for azd config set in your web browser.
  -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 show

顯示所有組態值。

概要

顯示組態路徑中的所有組態值。

組態目錄的預設值為:

  • $HOME/.azd 在 Linux 和 macOS 上
  • %USERPROFILE%\.azd 在 Windows 上

您可以在 AZD_CONFIG_DIR 環境變數中指定路徑,以覆寫組態目錄。

azd config show [flags]

選項。

      --docs   Opens the documentation for azd config show in your web browser.
  -h, --help   Gets help for show.

繼承自父命令的選項

  -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 unset

取消設定。

概要

拿掉組態路徑中的組態。

群組態目錄的預設值為:

  • $HOME/.azd 在 Linux 和 macOS 上
  • %USERPROFILE%\.azd 在 Windows 上

您可以在 AZD_CONFIG_DIR 環境變數中指定路徑,以覆寫組態目錄。

azd config unset <path> [flags]

範例

azd config unset defaults.location

選項。

      --docs   Opens the documentation for azd config unset in your web browser.
  -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 deploy

將應用程式的程式代碼部署至 Azure。

azd deploy <service> [flags]

選項。

      --all                   Deploys all services that are listed in azure.yaml
      --docs                  Opens the documentation for azd deploy in your web browser.
  -e, --environment string    The name of the environment to use.
      --from-package string   Deploys the application from an existing package.
  -h, --help                  Gets help for deploy.

繼承自父命令的選項

  -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 down

刪除應用程式的 Azure 資源。

azd down [flags]

選項。

      --docs                 Opens the documentation for azd down in your web browser.
  -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.
      --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 env

管理環境。

選項。

      --docs   Opens the documentation for azd env in your web browser.
  -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

取得所有環境值。

azd env get-values [flags]

選項。

      --docs                 Opens the documentation for azd env get-values in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for get-values.

繼承自父命令的選項

  -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 list

列出環境。

azd env list [flags]

選項。

      --docs   Opens the documentation for azd env list in your web browser.
  -h, --help   Gets help for list.

繼承自父命令的選項

  -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 new

建立新的環境,並將其設定為預設值。

azd env new <environment> [flags]

選項。

      --docs                  Opens the documentation for azd env new in your web browser.
  -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 refresh

使用先前基礎結構布建的資訊重新整理環境設定。

azd env refresh <environment> [flags]

選項。

      --docs                 Opens the documentation for azd env refresh in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for refresh.
      --hint string          Hint to help identify the environment to refresh

繼承自父命令的選項

  -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 select

設定預設環境。

azd env select <environment> [flags]

選項。

      --docs   Opens the documentation for azd env select in your web browser.
  -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 set

管理您的環境設定。

azd env set <key> <value> [flags]

選項。

      --docs                 Opens the documentation for azd env set in your web browser.
  -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 hooks

開發、測試及執行應用程式的勾點。 (Beta)

選項。

      --docs   Opens the documentation for azd hooks in your web browser.
  -h, --help   Gets help for hooks.

繼承自父命令的選項

  -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 hooks run

執行項目和服務指定的勾點

azd hooks run <name> [flags]

選項。

      --docs                 Opens the documentation for azd hooks run in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for run.
      --platform string      Forces hooks to run for the specified platform.
      --service string       Only runs hooks for the specified service.

繼承自父命令的選項

  -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 init

初始化新的應用程式。

azd init [flags]

選項。

  -b, --branch string         The template branch to initialize from. Must be used with a template argument (--template or -t).
      --docs                  Opens the documentation for azd init in your web browser.
  -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
  -s, --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.

另請參閱

azd monitor

監視已部署的應用程式。 (Beta)

azd monitor [flags]

選項。

      --docs                 Opens the documentation for azd monitor in your web browser.
  -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.

另請參閱

azd package

封裝要部署至 Azure 的應用程式程式代碼。 (Beta)

azd package <service> [flags]

選項。

      --all                  Packages all services that are listed in azure.yaml
      --docs                 Opens the documentation for azd package in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for package.
      --output-path string   File or folder path where the generated packages will be saved.

繼承自父命令的選項

  -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

管理和設定您的部署管線。 (Beta)

選項。

      --docs   Opens the documentation for azd pipeline in your web browser.
  -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

將您的部署管線設定為安全地連線到 Azure。 (Beta)

azd pipeline config [flags]

選項。

      --auth-type string             The authentication type used between the pipeline provider and Azure for deployment (Only valid for GitHub provider). Valid values: federated, client-credentials.
      --docs                         Opens the documentation for azd pipeline config in your web browser.
  -e, --environment string           The name of the environment to use.
  -h, --help                         Gets help for config.
      --principal-id string          The client id of the service principal to use to grant access to Azure resources as part of the pipeline.
      --principal-name string        The name of the service principal to use to grant access to Azure resources as part of the pipeline.
      --principal-role stringArray   The roles to assign to the service principal. By default the service principal will be granted the Contributor and User Access Administrator roles. (default [Contributor,User Access Administrator])
      --provider string              The pipeline provider to use (github for Github Actions and azdo for Azure Pipelines).
      --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 provision

布建應用程式的 Azure 資源。

azd provision [flags]

選項。

      --docs                 Opens the documentation for azd provision in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for provision.
      --no-state             Do not use latest Deployment State (bicep only).
      --preview              Preview changes to Azure resources.

繼承自父命令的選項

  -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 restore

還原應用程式的相依性。 (Beta)

azd restore <service> [flags]

選項。

      --all                  Restores all services that are listed in azure.yaml
      --docs                 Opens the documentation for azd restore in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for restore.

繼承自父命令的選項

  -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 show

顯示應用程式及其資源的相關信息。

azd show [flags]

選項。

      --docs                 Opens the documentation for azd show in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for show.

繼承自父命令的選項

  -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

尋找和檢視範本詳細數據。 (Beta)

選項。

      --docs   Opens the documentation for azd template in your web browser.
  -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

顯示範例 azd templates 的清單。 (Beta)

azd template list [flags]

選項。

      --docs            Opens the documentation for azd template list in your web browser.
  -h, --help            Gets help for list.
  -s, --source string   Filters templates by source.

繼承自父命令的選項

  -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 show

顯示指定範本的詳細資料。 (Beta)

azd template show <template> [flags]

選項。

      --docs   Opens the documentation for azd template show in your web browser.
  -h, --help   Gets help for show.

繼承自父命令的選項

  -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 source

檢視和管理範本來源。 (Beta)

選項。

      --docs   Opens the documentation for azd template source in your web browser.
  -h, --help   Gets help for source.

繼承自父命令的選項

  -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 source add

在指定的索引鍵上新增 azd 範本來源 (Beta)

azd template source add <key> [flags]

選項。

      --docs              Opens the documentation for azd template source add in your web browser.
  -h, --help              Gets help for add.
  -l, --location string   Location of the template source.
  -n, --name string       Display name of the template source.
  -t, --type string       Kind of the template source.

繼承自父命令的選項

  -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 source list

列出已設定的 azd 範本來源。 (Beta)

azd template source list [flags]

選項。

      --docs   Opens the documentation for azd template source list in your web browser.
  -h, --help   Gets help for list.

繼承自父命令的選項

  -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 source remove

移除指定的 azd 範本來源 (Beta)

azd template source remove <key> [flags]

選項。

      --docs   Opens the documentation for azd template source remove in your web browser.
  -h, --help   Gets help for remove.

繼承自父命令的選項

  -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 up

布建 Azure 資源,並使用單一命令部署您的專案。

azd up [flags]

選項。

      --docs                 Opens the documentation for azd up in your web browser.
  -e, --environment string   The name of the environment to use.
  -h, --help                 Gets help for up.

繼承自父命令的選項

  -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 version

列印 Azure 開發人員 CLI 的版本號碼。

azd version [flags]

選項。

      --docs   Opens the documentation for azd version in your web browser.
  -h, --help   Gets help for version.

繼承自父命令的選項

  -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.

另請參閱