azure.azcollection.azure_rm_containerapp module – Manage Azure Container Apps
Note
This module is part of the azure.azcollection collection (version 4.2.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install azure.azcollection.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: azure.azcollection.azure_rm_containerapp.
New in azure.azcollection 4.0.0
Synopsis
Create, update, delete, start and stop an Azure Container App.
Container Apps run in a Managed Environment created with azure.azcollection.azure_rm_containerappenvironment.
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.7
The host that executes this module must have the azure.azcollection collection installed via galaxy
All python packages listed in collection’s requirements.txt must be installed via pip on the host that executes modules from azure.azcollection
Full installation instructions may be found https://galaxy.ansible.com/azure/azcollection
Parameters
Parameter |
Comments |
|---|---|
Active revisions mode for the container app. Choices:
|
|
Active Directory username. Use when authenticating with an Active Directory user rather than service principal. |
|
Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. |
|
Selects an API profile to use when communicating with Azure services. Default value of Default: |
|
Use to control if tags field is canonical or just appends to existing tags. When canonical, any tags not found in the tags parameter will be removed from the object’s metadata. Choices:
|
|
Controls the source of the credentials to use for authentication. Can also be set via the When set to When set to When set to When set to When set to The Choices:
|
|
Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing Choices:
|
|
Azure client ID. Use when authenticating with a Service Principal or Managed Identity (msi). Can also be set via the |
|
For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, Default: |
|
List of containers that make up the app. |
|
Container start command arguments. |
|
Container start command. |
|
Container environment variables. |
|
Environment variable name. |
|
Name of the container-app secret to pull the value from. |
|
Environment variable value. |
|
Container image tag. |
|
Container name. |
|
List of probes for the container. |
|
Container resource requests. |
|
CPU cores in decimal notation. |
|
Ephemeral storage. |
|
Memory (for example |
|
List of volume mounts inside the container. |
|
Mount path inside the container. |
|
Path inside the volume. |
|
Volume name. |
|
Dapr configuration for the container app. |
|
Dapr application identifier. |
|
Port on which the app listens. |
|
Protocol Dapr uses to talk to the app. Choices:
|
|
Enables API logging for the Dapr sidecar. Choices:
|
|
Whether Dapr is enabled on the app. Choices:
|
|
Increasing max size of request body http server parameter in kilobytes. |
|
Maximum size of HTTP header read buffer in kilobytes. |
|
Dapr sidecar log level. Choices:
|
|
Determines whether or not instance discovery is performed when attempting to authenticate. Setting this to true will completely disable both instance discovery and authority validation. This functionality is intended for use in scenarios where the metadata endpoint cannot be reached such as in private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and trustworthy. Set via credential file profile or the Choices:
|
|
Full resource ID of the parent managed environment. Required when creating a container app. |
|
Managed identity assigned to the container app. |
|
Type of the managed identity. Choices:
|
|
User-assigned managed identities. Default: |
|
Whether to append the provided identities to any already assigned. Choices:
|
|
List of resource IDs of user-assigned managed identities. Default: |
|
Ingress configuration for the container app. |
|
Extra port mappings exposed by the container app ingress. |
|
Exposed port. Defaults to |
|
Whether the port is accessible outside the environment. Choices:
|
|
Port the container listens on. |
|
Allow insecure HTTP connections. Choices:
|
|
Client certificate mode. Choices:
|
|
CORS policy pass-through as an SDK-shaped dict. |
|
Custom domain bindings. |
|
Binding type. Choices:
|
|
Resource ID of the certificate. |
|
Domain hostname. |
|
Exposed TCP port (transport |
|
Whether ingress is externally reachable. Choices:
|
|
IP-based restrictions. |
|
Allow or Deny. Choices:
|
|
Rule description. |
|
CIDR notation for the range. |
|
Rule name. |
|
Sticky session configuration for single-revision mode. |
|
Sticky session affinity. Choices:
|
|
Container port that ingress forwards to. |
|
Traffic weights across revisions. |
|
Associates a traffic label with a revision. |
|
Whether the traffic weight targets the latest revision. Choices:
|
|
Target revision name. |
|
Traffic weight assigned to the revision. |
|
Transport protocol. Choices:
|
|
Container definitions that run before the app containers. Same schema as containers. |
|
Init container start command arguments. |
|
Init container start command. |
|
Init container environment variables. |
|
Environment variable name. |
|
Name of the container-app secret to pull the value from. |
|
Environment variable value. |
|
Init container image tag. |
|
Init container name. |
|
Init container resource requests. |
|
CPU cores in decimal notation. |
|
Ephemeral storage. |
|
Memory (for example |
|
List of volume mounts inside the init container. |
|
Mount path inside the container. |
|
Path inside the volume. |
|
Volume name. |
|
Metadata used to identify the container app category.
Choices:
|
|
Resource location. If not set, location from the resource group will be used. |
|
Parent argument. |
|
Parent argument. |
|
Maximum number of inactive revisions the app will keep. |
|
Name of the container app. |
|
Direct OpenID Connect (OIDC) token (JWT) used for workload identity authentication. This token is exchanged with Azure AD using OIDC federated identity. Useful in CI systems (for example GitHub Actions, Azure DevOps) where an OIDC token is provided directly by the platform. Can also be set via the |
|
Path to a file containing an OpenID Connect (OIDC) token (JWT) used for workload identity authentication. The file must contain only raw token. This method is commonly used in platforms that materialize OIDC tokens as files Can also be set via the |
|
Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. |
|
Security profile found in ~/.azure/credentials file. |
|
Container image registries the container app pulls from. |
|
Resource ID of a user-assigned managed identity, or |
|
Name of the secret in secrets that contains the registry password. |
|
Container registry server (for example |
|
Registry username. Omit when using managed identity. |
|
The name of the resource group. |
|
User-friendly suffix appended to the revision name. |
|
Scaling configuration. |
|
Cooldown period in seconds after scaling. |
|
Maximum replica count. |
|
Minimum replica count. |
|
Interval in seconds between scaling decisions. |
|
List of KEDA scaling rules. Each item follows the SDK ScaleRule model shape. |
|
Azure client secret. Use when authenticating with a Service Principal. |
|
List of secrets exposed to the container app. |
|
Resource ID of the managed identity used to access the Key Vault secret. Use |
|
Azure Key Vault URL pointing at the secret. |
|
Secret name. |
|
Secret value. |
|
List of Container App service bindings (dev-service bindings). |
|
Name of the service bind. |
|
Resource ID of the target dev service. |
|
Assert the state of the container app. Choices:
|
|
Runtime action to apply after any create/update.
Choices:
|
|
Your Azure subscription Id. |
|
Dictionary of string:string pairs to assign as metadata to the object. Metadata tags on the object will be updated with any provided values. To remove tags set append_tags option to false. Currently, Azure DNS zones and Traffic Manager services also don’t allow the use of spaces in the tag. Azure Front Door doesn’t support the use of Azure Automation and Azure CDN only support 15 tags on resources. |
|
Azure tenant ID. Use when authenticating with a Service Principal. |
|
Optional duration in seconds the app instance needs to terminate gracefully. |
|
The thumbprint of the private key specified in x509_certificate_path. Use when authenticating with a Service Principal. Required if x509_certificate_path is defined. |
|
List of volumes for containers to mount. |
|
Workload profile name to pin the app to. Must exist on the parent environment. |
|
Path to the X509 certificate used to create the service principal in PEM format. The certificate must be appended to the private key. Use when authenticating with a Service Principal. |
Notes
Note
For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with
az login.Authentication is also possible using a service principal or Active Directory user.
To authenticate via OIDC, pass client_id, tenant and oidc_token or oidc_token_file_path, or set environment variables AZURE_CLIENT_ID, AZURE_TENANT and AZURE_FEDERATED_TOKEN or AZURE_FEDERATED_TOKEN_FILE.
To authenticate via service principal, pass subscription_id, client_id, secret and tenant or set environment variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT.
To authenticate via Active Directory user, pass ad_user and password, or set AZURE_AD_USER and AZURE_PASSWORD in the environment.
Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription_id, client_id, secret and tenant or subscription_id, ad_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE_PROFILE in the environment.
See Also
See also
- Sign in with Azure CLI
How to authenticate using the
az logincommand.
Examples
- name: Create minimal container app
azure.azcollection.azure_rm_containerapp:
resource_group: myResourceGroup
name: hello
environment_id: "/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.App/managedEnvironments/myenv"
ingress:
external: true
target_port: 80
transport: auto
containers:
- name: hello
image: mcr.microsoft.com/k8se/quickstart:latest
resources:
cpu: 0.25
memory: 0.5Gi
scale:
min_replicas: 0
max_replicas: 3
- name: Container app pulling from ACR with user-assigned managed identity
azure.azcollection.azure_rm_containerapp:
resource_group: myResourceGroup
name: private-app
environment_id: "{{ env_id }}"
identity:
type: UserAssigned
user_assigned_identities:
id:
- "/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aca-pull"
registries:
- server: myacr.azurecr.io
identity: "/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aca-pull"
containers:
- name: app
image: myacr.azurecr.io/hello:1.0
resources:
cpu: 0.5
memory: 1Gi
- name: Stop the container app
azure.azcollection.azure_rm_containerapp:
resource_group: myResourceGroup
name: hello
status: stop
- name: Delete the container app
azure.azcollection.azure_rm_containerapp:
resource_group: myResourceGroup
name: hello
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Current state of the container app. Returned: always |
|
App configuration. Returned: always |
|
Fully qualified resource ID. Returned: always |
|
FQDN of the latest revision. Returned: always |
|
Latest revision name of the app. Returned: always |
|
Resource location. Returned: always |
|
Container app name. Returned: always |
|
Provisioning state. Returned: always |
|
App template with containers and scaling. Returned: always |