You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugin for Helm to inject Azure information (subscriptions, resources, msgraph) and Azure KeyVault secrets.
Also works as standalone executable outside of Helm.
# Installation of latest version helm plugin install "https://github.com/webdevops/helm-azure-tpl/releases/latest/download/azure-tpl-cli.tgz" --verify=false helm plugin install "https://github.com/webdevops/helm-azure-tpl/releases/latest/download/azure-tpl-getter.tgz" --verify=false
# Installation of specific version helm plugin install "https://github.com/webdevops/helm-azure-tpl/releases/download/0.63.9/azure-tpl-cli.tgz" --verify=false helm plugin install "https://github.com/webdevops/helm-azure-tpl/releases/download/0.63.9/azure-tpl-getter.tgz" --verify=false
# Update # please do uninstall and install again, for now
# Installation of latest version helm plugin install https://github.com/webdevops/helm-azure-tpl.git
# Installation of specific version helm plugin install https://github.com/webdevops/helm-azure-tpl.git --version=0.63.9
# Update to latest version helm plugin update azure-tpl
# Uninstall helm plugin uninstall azure-tpl
Usage
Helm (downloader mode)
you can use helm in "downloader" mode to process files eg:
Caution
DO NOT use azure-tpl functions in values.yaml files as these files are read again by helm without azure-tpl processing! Use different file names and paths.
Application Options: --log.level=[trace|debug|info|warning|error] Log level (default: info) [$AZURETPL_LOG_LEVEL] --log.format=[logfmt|json] Log format (default: logfmt) [$AZURETPL_LOG_FORMAT] --log.source=[|short|file|full] Show source for every log message (useful for debugging and bug reports) [$AZURETPL_LOG_SOURCE] --log.color=[|auto|yes|no] Enable color for logs [$AZURETPL_LOG_COLOR] --log.time Show log time [$AZURETPL_LOG_TIME] --dry-run dry run, do not write any files [$AZURETPL_DRY_RUN] --debug debug run, print generated content to stdout (WARNING: can expose secrets!) [$HELMHELM_DEBUG_DEBUG] --stdout Print parsed content to stdout instead of file (logs will be written to stderr) [$AZURETPL_STDOUT] --template.basepath= sets custom base path (if empty, base path is set by base directory for each file. will be appended to all root paths inside templates) [$AZURETPL_TEMPLATE_BASEPATH] --target.prefix= adds this value as prefix to filename on save (not used if targetfile is specified in argument) [$AZURETPL_TARGET_PREFIX] --target.suffix= adds this value as suffix to filename on save (not used if targetfile is specified in argument) [$AZURETPL_TARGET_SUFFIX] --target.fileext= replaces file extension (or adds if empty) with this value (eg. '.yaml') [$AZURETPL_TARGET_FILEEXT] --keyvault.expiry.warningduration= warn before soon expiring Azure KeyVault entries (default: 168h) [$AZURETPL_KEYVAULT_EXPIRY_WARNING_DURATION] --keyvault.expiry.ignore ignore expiry date of Azure KeyVault entries and don't fail' [$AZURETPL_KEYVAULT_EXPIRY_IGNORE] --values= path to yaml files for .Values [$AZURETPL_VALUES] --set-json= set JSON values on the command line (can specify multiple or separate values with commas: key1=jsonval1,key2=jsonval2) --set= set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-string= set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-file= set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
Help Options: -h, --help Show this help message
Arguments: command: specifies what to do (help, version, lint, apply) files: list of files to process (will overwrite files, different target file can be specified as sourcefile:targetfile)
Build-in objects
Object
Description
.Values
Additional data can be passed via --values=values.yaml files which is available under .Values (like Helm)
Template functions
Azure template functions
Note
Functions can also be used starting with azure prefix instead of az
Function
Parameters
Description
azAccountInfo
Output of az account show
azManagementGroup
groupID (string)
Fetches Azure managementGroup
azManagementGroupSubscriptionList
groupID (string)
Fetches list of all subscriptions (recursive) inside an Azure managementGroup
azSubscription
subscriptionID (string, optional)
Fetches Azure subscription (current selected one if subscriptionID is empty)
azSubscriptionList
Fetches list of all visible azure subscriptions
azResource
resourceID (string), apiVersion (string)
Fetches Azure resource information (json representation, interface object)
azResourceList
scope (string), filter (string, optional)
Fetches list of Azure resources and filters it by using $filter, scope can be subscription ID or resourceGroup ID (array, json representation, interface object)
azPublicIpAddress
resourceID (string)
Fetches ip address from Azure Public IP
azPublicIpPrefixAddressPrefix
resourceID (string)
Fetches ip address prefix from Azure Public IP prefix
azVirtualNetworkAddressPrefixes
resourceID (string)
Fetches address prefix (string array) from Azure VirtualNetwork
azVirtualNetworkSubnetAddressPrefixes
resourceID (string), subnetName (string)
Fetches address prefix (string array) from Azure VirtualNetwork subnet
Azure KeyVault functions
Function
Parameters
Description
azKeyVaultSecret
vaultUrl (string), secretName (string), version (string, optional)
Fetches Azure RoleDefinition using scope (eg /subscriptions/xxx) and roleName
azRoleDefinitionList
scope (string), filter (string,optional)
Fetches list of Azure RoleDefinitions using scope (eg /subscriptions/xxx) and optional $filter query
Azure ResourceGraph functions
Function
Parameters
Description
azResourceGraphQuery
scope (string or []string), query (string)
Executes Azure ResourceGraph query against selected subscription IDs or management group IDs (as string comma separated or string array) Use "/providers/microsoft.management/managementgroups/" as prefix for each management group
Note
ManagementGroups must be defined with their resource ID /providers/microsoft.management/managementgroups/{MANAGEMENT_GROUP_ID}.
Subscriptions must either be defined by the subscription id or their resource id /subscriptions/{SUBSCRIPTION_ID}.
MsGraph (AzureAD) functions
Note
Functions can also be used starting with msGraph prefix instead of mg
## Fetch secret value from Azure KeyVault (using only name; only AzurePublicCloud, AzureChinaCloud and AzureGovernmentCloud) {{ (azKeyVaultSecret "examplevault" "secretname").value }} {{ (azKeyVaultSecret "examplevault" "secretname").attributes.exp | fromUnixtime | toRFC3339 }}
## Fetch secret value from Azure KeyVault (using full url) {{ (azKeyVaultSecret "https://examplevault.vault.azure.net/" "secretname").value }}
## Fetch current environmentName {{ azAccountInfo.environmentName }}
## Fetch current tenantId {{ azAccountInfo.tenantId }}
## Fetch current selected subscription displayName {{ azSubscription.displayName }}
## Fetch RoleDefinition id for "owner" role {{ (azRoleDefinition "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" "Owner").name }}
## Executes ResourceGraph query and returns result as yaml {{ azResourceGraphQuery "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" `resources | where resourceGroup contains "xxxx"` | toYaml }} or {{ `resources | where resourceGroup contains "xxxx"` | azResourceGraphQuery "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx" | toYaml }}
## Executes ResourceGraph query for Management Group and returns result as yaml {{ azResourceGraphQuery "/providers/microsoft.management/managementgroups/xxxxxxxx-x xxx-xxxx-xxxx-xxxxxxxxxxx" `resources | where resourceGroup contains "xxxx"` | toYaml }} or {{ `resources | where resourceGroup contains "xxxx"` | azResourceGraphQuery "/providers/microsoft.management/managementgroups/xxxxxxxx-x xxx-xxxx-xxxx-xxxxxxxxxxx" | toYaml }}
## Fetch kubeconfig from AKS managed cluster {{ (index (azManagedClusterUserCredentials "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resource groups/example-rg/providers/Microsoft.ContainerService/manag edClusters/foobar").kubeconfigs 0).value | b64dec }}