az containerapp github-action

Note

This reference is part of the containerapp extension for the Azure CLI (version 2.37.0 or higher). The extension will automatically install the first time you run an az containerapp github-action command. Learn more about extensions.

Commands to manage GitHub Actions.

Commands

az containerapp github-action add

Add a GitHub Actions workflow to a repository to deploy a container app.

az containerapp github-action delete

Remove a previously configured Container Apps GitHub Actions workflow from a repository.

az containerapp github-action show

Show the GitHub Actions configuration on a container app.

az containerapp github-action add

Add a GitHub Actions workflow to a repository to deploy a container app.

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

Examples

Add GitHub Actions, using Azure Container Registry and personal access token.

az containerapp github-action add -g MyResourceGroup -n MyContainerapp --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

Add GitHub Actions, using Azure Container Registry and log in to GitHub flow to retrieve personal access token.

az containerapp github-action add -g MyResourceGroup -n MyContainerapp --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

Add GitHub Actions, using Docker Hub and log in to GitHub flow to retrieve personal access token.

az containerapp github-action add -g MyResourceGroup -n MyContainerapp --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

Required Parameters

--name -n

The name of the Containerapp. A name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, cannot have '--', and must be less than 32 characters.

--repo-url

The GitHub repository to which the workflow file will be added. In the format: https://github.com//.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--branch -b

The branch of the Github repo. Assumed to be the Github repo's default branch if not specified.

--context-path

Path in the repo from which to run the docker build. Defaults to "./".

--image -i

Container image name that the Github Action should use. Defaults to the Container App name.

--login-with-github

Interactively log in with Github to retrieve the Personal Access Token.

--registry-password

The password of the registry. If using Azure Container Registry, we will try to infer the credentials if not supplied.

--registry-url

The container registry server, e.g. myregistry.azurecr.io.

--registry-username

The username of the registry. If using Azure Container Registry, we will try to infer the credentials if not supplied.

--service-principal-client-id

The service principal client ID.

--service-principal-client-secret

The service principal client secret.

--service-principal-tenant-id

The service principal tenant ID.

--token

A Personal Access Token with write access to the specified repository. For more information: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line.

az containerapp github-action delete

Remove a previously configured Container Apps GitHub Actions workflow from a repository.

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

Examples

Remove GitHub Actions using a personal access token.

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

Remove GitHub Actions using log in to GitHub flow to retrieve personal access token.

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

Required Parameters

--name -n

The name of the Containerapp. A name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, cannot have '--', and must be less than 32 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--login-with-github

Interactively log in with Github to retrieve the Personal Access Token.

--token

A Personal Access Token with write access to the specified repository. For more information: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line.

az containerapp github-action show

Show the GitHub Actions configuration on a container app.

az containerapp github-action show --name
                                   --resource-group

Examples

Show the GitHub Actions configuration on a Containerapp.

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

Required Parameters

--name -n

The name of the Containerapp. A name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, cannot have '--', and must be less than 32 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.