Share via


az aks draft

Note

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

Commands to build deployment files in a project directory and deploy to an AKS cluster.

Commands

Name Description Type Status
az aks draft create

Generate a Dockerfile and the minimum required Kubernetes deployment files (helm, kustomize, manifests) for your project directory.

Extension GA
az aks draft generate-workflow

Generate a GitHub workflow for automatic build and deploy to AKS.

Extension GA
az aks draft setup-gh

Set up GitHub OIDC for your application.

Extension GA
az aks draft up

Run az aks draft setup-gh then az aks draft generate-workflow.

Extension GA
az aks draft update

Update your application to be internet accessible.

Extension GA

az aks draft create

Generate a Dockerfile and the minimum required Kubernetes deployment files (helm, kustomize, manifests) for your project directory.

az aks draft create [--app]
                    [--create-config]
                    [--deployment-only]
                    [--destination]
                    [--dockerfile-only]
                    [--language]
                    [--path]

Examples

Prompt to generate a Dockerfile and deployment files in the current directory.

az aks draft create

Generate only the Dockerfile in the current directory.

az aks draft create --dockerfile-only=true

Generate only the deployment files in the current directory.

az aks draft create --deployment-only=true

Generate a Dockerfile and an deployment file in a Java project with an app name at a specific project directory.

az aks draft create --language=java --app=some_app --destination=/projects/some_project

Optional Parameters

--app

Specify the name of the helm release.

--create-config

Specify the path to the configuration file.

--deployment-only

Only generate deployment files (helm, kustomize, manifests) for the Kubernetes deployment.

--destination

Specify the path to the project directory (default is .).

Default value: .
--dockerfile-only

Only generate Dockerfile for the Kubernetes deployment.

--language

Specify the language used to create the Kubernetes deployment.

--path

Automatically download and use the Draft binary at the specified location.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az aks draft generate-workflow

Generate a GitHub workflow for automatic build and deploy to AKS.

Before running this command, Make sure you have set up GitHub OIDC for your application. You also need to create a resource group, a container registry and a Kubernetes cluster on Azure and link the three resources using az aks update -n <cluster-name> -g <resource-group-name> --attach-acr <acr-name>.

az aks draft generate-workflow [--branch]
                               [--cluster-name]
                               [--container-name]
                               [--destination]
                               [--path]
                               [--registry-name]
                               [--resource-group]

Examples

Prompt to generate a GitHub workflow in the current directory.

az aks draft generate-workflow

Prompt to generate a GitHub workflow in a specific project directory.

az aks draft generate-workflow --destination=/projects/some_project

Generate a GitHub workflow with a resource group, an AKS cluster name, a container registry name in a specific project directory.

az aks draft generate-workflow --resource-group=some_rg --cluster-name=some_cluster --registry-name=some_registry --destination=/projects/some_project

Generate a GitHub workflow that deploys from the main branch with a resource group, an AKS cluster name, a container registry name, and a container image name in a specific project directory.

az aks draft generate-workflow --branch=main --resource-group=some_rg --cluster-name=some_cluster --registry-name=some_registry --container-name=some_image --destination=/projects/some_project

Optional Parameters

--branch

Specify the GitHub branch to automatically deploy from.

--cluster-name

Specify the AKS cluster name.

--container-name

Specify the name of the container image.

--destination

Specify the path to the project directory (default is .).

--path

Automatically download and use the Draft binary at the specified location.

--registry-name

Specify the path to the project directory.

--resource-group

Specify the name of the Azure resource group.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az aks draft setup-gh

Set up GitHub OIDC for your application.

az aks draft setup-gh [--app]
                      [--gh-repo]
                      [--path]
                      [--provider]
                      [--resource-group]
                      [--subscription-id]

Examples

Prompt to setup the GitHub OIDC for a repository.

az aks draft setup-gh

Setup the GitHub OIDC on Azure for a specific repository.

az aks draft setup-gh --provider=azure --gh-repo=some_organization/some_repo

Setup the GitHub OIDC on Azure with subscription ID and resource group.

az aks draft setup-gh --provider=azure --subscription-id=some_subscription --resource-group=some_rg

Setup the GitHub OIDC with an application name on Azure with subscription ID and resource group for a specific repository.

az aks draft setup-gh --app=some_app --provider=azure --subscription-id=some_subscription --resource-group=some_rg --gh-repo=some_organization/some_repo

Optional Parameters

--app

Specify the Azure Active Directory applicaton name.

--gh-repo

Specify the the GitHub repository (organization/repo_name).

--path

Automatically download and use the Draft binary at the specified location.

--provider

Specify the cloud provider (default is azure).

Default value: azure
--resource-group

Specify the name of the Azure resource group.

--subscription-id

Specify the Azure subscription ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az aks draft up

Run az aks draft setup-gh then az aks draft generate-workflow.

This command combines az aks draft setup-gh and az aks draft generate-workflow to set up GitHub OIDC and generate a GitHub workflow for automatic build and deploy to AKS. Before running this command, create a resource group, a container registry and a Kubernetes cluster on Azure and link the three resources using az aks update -n <cluster-name> -g <resource-group-name> --attach-acr <acr-name>.

az aks draft up [--app]
                [--branch]
                [--cluster-name]
                [--container-name]
                [--destination]
                [--gh-repo]
                [--path]
                [--provider]
                [--registry-name]
                [--resource-group]
                [--subscription-id]

Examples

Prompt to setup the GitHub OIDC then generate a GitHub workflow in the current directory.

az aks draft up

Prompt to setup the GitHub OIDC then generate a GitHub workflow in a specific project directory.

az aks draft up --destination=/projects/some_project

Prompt to setup the GitHub OIDC for a specific repository then generate a GitHub workflow in a specific project directory.

az aks draft up --gh-repo=some_organization/some_repo --destination=/projects/some_project

Optional Parameters

--app

Specify the name of the application.

--branch

Specify the GitHub branch to automatically deploy from.

--cluster-name

Specify the AKS cluster name.

--container-name

Specify the name of the container image.

--destination

Specify the path to the project directory (default is .).

--gh-repo

Specify the the GitHub repository (organization/repo_name).

--path

Automatically download and use the Draft binary at the specified location.

--provider

Specify the cloud provider (default is azure).

Default value: azure
--registry-name

Specify the path to the project directory.

--resource-group

Specify the name of the Azure resource group.

--subscription-id

Specify the Azure subscription ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az aks draft update

Update your application to be internet accessible.

This command automatically updates your yaml files as necessary so that your application will be able to receive external requests.

az aks draft update [--certificate]
                    [--destination]
                    [--host]
                    [--path]

Examples

Prompt to update the application to be internet accessible.

az aks draft update

Prompt to update the application to be internet accessible in a specific project directory.

az aks draft update --destination=/projects/some_project

Update the application to be internet accessible with a host of the ingress resource and a Keyvault certificate in a specific project directory.

az aks draft update --host=some_host --certificate=some_certificate --destination=/projects/some_project

Optional Parameters

--certificate

Specify the URI of the Keyvault certificate to present.

--destination

Specify the path to the project directory (default is .).

--host

Specify the host of the ingress resource.

--path

Automatically download and use the Draft binary at the specified location.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.