Share via


az containerapp github-action

注意

此命令群組具有 Azure CLI 和至少一個擴充功能中定義的命令。 安裝每個擴充功能以受益於其擴充功能。 深入了解擴充功能。

管理 GitHub Actions 的命令。

命令

名稱 Description 類型 狀態
az containerapp github-action add

將 GitHub Actions 工作流程新增至存放庫,以部署容器應用程式。

核心 GA
az containerapp github-action add (containerapp 擴充功能)

將 GitHub Actions 工作流程新增至存放庫,以部署容器應用程式。

副檔名 GA
az containerapp github-action delete

從存放庫移除先前設定的 Container Apps GitHub Actions 工作流程。

核心 GA
az containerapp github-action show

在容器應用程式上顯示 GitHub Actions 設定。

核心 GA

az containerapp github-action add

將 GitHub Actions 工作流程新增至存放庫,以部署容器應用程式。

az containerapp github-action add --repo-url
                                  [--branch]
                                  [--context-path]
                                  [--ids]
                                  [--image]
                                  [--login-with-github]
                                  [--name]
                                  [--registry-password]
                                  [--registry-url]
                                  [--registry-username]
                                  [--resource-group]
                                  [--service-principal-client-id]
                                  [--service-principal-client-secret]
                                  [--service-principal-tenant-id]
                                  [--subscription]
                                  [--token]

範例

使用 Azure Container Registry 和個人存取令牌新增 GitHub Actions。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-url myregistryurl.azurecr.io --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --token MyAccessToken

使用 Azure Container Registry 新增 GitHub Actions,並登入 GitHub 流程以擷取個人存取令牌。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-url myregistryurl.azurecr.io --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --login-with-github

使用 Docker Hub 新增 GitHub Actions,並登入 GitHub 流程以擷取個人存取令牌。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-username MyUsername --registry-password MyPassword --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --login-with-github

必要參數

--repo-url

將新增工作流程檔案的 GitHub 存放庫。 格式為: https://github.com//。

選擇性參數

--branch -b

Github 存放庫的分支。 如果未指定,則假設為 Github 存放庫的預設分支。

--context-path

用來執行 Docker 組建之存放庫中的路徑。 默認為 “./”。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--image -i

Github Action 應該使用的容器映像名稱。 默認為容器應用程式名稱。

--login-with-github

以互動方式使用 Github 登入以擷取個人存取令牌。

預設值: False
--name -n

Containerapp 的名稱。 名稱必須包含小寫英數位元或 '-'、以字母開頭、以英數位元結尾、不能有 '--' 且必須小於 32 個字元。

--registry-password

登錄的密碼。 如果使用 Azure Container Registry,我們會嘗試在未提供時推斷認證。

--registry-url

容器登錄伺服器,例如 myregistry.azurecr.io。

--registry-username

登錄的用戶名稱。 如果使用 Azure Container Registry,我們會嘗試在未提供時推斷認證。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--service-principal-client-id

服務主體用戶端識別碼。

--service-principal-client-secret

服務主體客戶端密碼。

--service-principal-tenant-id

服務主體租用戶標識碼。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--token

具有指定存放庫寫入許可權的個人存取令牌。 如需詳細資訊: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az containerapp github-action add (containerapp 擴充功能)

將 GitHub Actions 工作流程新增至存放庫,以部署容器應用程式。

az containerapp github-action add --repo-url
                                  [--branch]
                                  [--build-env-vars]
                                  [--context-path]
                                  [--ids]
                                  [--image]
                                  [--login-with-github]
                                  [--name]
                                  [--registry-password]
                                  [--registry-url]
                                  [--registry-username]
                                  [--resource-group]
                                  [--service-principal-client-id]
                                  [--service-principal-client-secret]
                                  [--service-principal-tenant-id]
                                  [--subscription]
                                  [--token]

範例

使用 Azure Container Registry 和個人存取令牌新增 GitHub Actions。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-url myregistryurl.azurecr.io --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --token MyAccessToken

使用 Azure Container Registry 和個人存取令牌新增 GitHub Actions,透過建置環境變數來設定映像建置。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-url myregistryurl.azurecr.io --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --token MyAccessToken --build-env-vars BP_JVM_VERSION=21 BP_MAVEN_VERSION=4

使用 Azure Container Registry 新增 GitHub Actions,並登入 GitHub 流程以擷取個人存取令牌。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-url myregistryurl.azurecr.io --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --login-with-github

使用 Docker Hub 新增 GitHub Actions,並登入 GitHub 流程以擷取個人存取令牌。

az containerapp github-action add -g MyResourceGroup -n my-containerapp --repo-url https://github.com/userid/repo --branch main --registry-username MyUsername --registry-password MyPassword --service-principal-client-id 00000000-0000-0000-0000-00000000 --service-principal-tenant-id 00000000-0000-0000-0000-00000000 --service-principal-client-secret ClientSecret --login-with-github

必要參數

--repo-url

將新增工作流程檔案的 GitHub 存放庫。 格式為: https://github.com//。

選擇性參數

--branch -b

Github 存放庫的分支。 如果未指定,則假設為 Github 存放庫的預設分支。

--build-env-vars
預覽

組建的環境變數清單。 以 『key=value』 格式分隔的空間值。

--context-path

用來執行 Docker 組建之存放庫中的路徑。 默認為 “./”。

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--image -i

Github Action 應該使用的容器映像名稱。 默認為容器應用程式名稱。

--login-with-github

以互動方式使用 Github 登入以擷取個人存取令牌。

預設值: False
--name -n

Containerapp 的名稱。 名稱必須包含小寫英數位元或 '-'、以字母開頭、以英數位元結尾、不能有 '--' 且必須小於 32 個字元。

--registry-password

登錄的密碼。 如果使用 Azure Container Registry,我們會嘗試在未提供時推斷認證。

--registry-url

容器登錄伺服器,例如 myregistry.azurecr.io。

--registry-username

登錄的用戶名稱。 如果使用 Azure Container Registry,我們會嘗試在未提供時推斷認證。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--service-principal-client-id

服務主體用戶端識別碼。

--service-principal-client-secret

服務主體客戶端密碼。

--service-principal-tenant-id

服務主體租用戶標識碼。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--token

具有指定存放庫寫入許可權的個人存取令牌。 如需詳細資訊: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az containerapp github-action delete

從存放庫移除先前設定的 Container Apps GitHub Actions 工作流程。

az containerapp github-action delete [--ids]
                                     [--login-with-github]
                                     [--name]
                                     [--resource-group]
                                     [--subscription]
                                     [--token]

範例

使用個人存取令牌移除 GitHub Actions。

az containerapp github-action delete -g MyResourceGroup -n MyContainerapp --token MyAccessToken

使用登入 GitHub 流程來移除 GitHub Actions,以擷取個人存取令牌。

az containerapp github-action delete -g MyResourceGroup -n MyContainerapp --login-with-github

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--login-with-github

以互動方式使用 Github 登入以擷取個人存取令牌。

預設值: False
--name -n

Containerapp 的名稱。 名稱必須包含小寫英數位元或 '-'、以字母開頭、以英數位元結尾、不能有 '--' 且必須小於 32 個字元。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--token

具有指定存放庫寫入許可權的個人存取令牌。 如需詳細資訊: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az containerapp github-action show

在容器應用程式上顯示 GitHub Actions 設定。

az containerapp github-action show [--ids]
                                   [--name]
                                   [--resource-group]
                                   [--subscription]

範例

在 Containerapp 上顯示 GitHub Actions 組態。

az containerapp github-action show -g MyResourceGroup -n MyContainerapp

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--name -n

Containerapp 的名稱。 名稱必須包含小寫英數位元或 '-'、以字母開頭、以英數位元結尾、不能有 '--' 且必須小於 32 個字元。

--resource-group -g

資源群組的名稱。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。