{"id":13840200,"url":"https://github.com/getporter/az-mixin","last_synced_at":"2025-07-28T01:33:07.841Z","repository":{"id":38379864,"uuid":"184328392","full_name":"getporter/az-mixin","owner":"getporter","description":"An Azure CLI mixin for Porter","archived":false,"fork":false,"pushed_at":"2024-08-23T17:10:30.000Z","size":2290,"stargazers_count":0,"open_issues_count":6,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-21T09:36:11.716Z","etag":null,"topics":["az","azure","cnab","mixin","porter"],"latest_commit_sha":null,"homepage":"https://getporter.org/mixins/az/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getporter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-30T20:38:44.000Z","updated_at":"2024-08-23T17:06:58.000Z","dependencies_parsed_at":"2024-01-20T21:49:00.327Z","dependency_job_id":"295a4296-4fc1-42a0-8687-7d7248c7d59c","html_url":"https://github.com/getporter/az-mixin","commit_stats":{"total_commits":63,"total_committers":8,"mean_commits":7.875,"dds":0.5873015873015873,"last_synced_commit":"79fd321dbe38bd72452305f01d12b6979f8b0169"},"previous_names":["deislabs/porter-az"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getporter%2Faz-mixin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getporter%2Faz-mixin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getporter%2Faz-mixin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getporter%2Faz-mixin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getporter","download_url":"https://codeload.github.com/getporter/az-mixin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227855192,"owners_count":17830157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["az","azure","cnab","mixin","porter"],"created_at":"2024-08-04T17:00:43.550Z","updated_at":"2025-07-28T01:33:07.831Z","avatar_url":"https://github.com/getporter.png","language":"Go","funding_links":[],"categories":["Implementations"],"sub_categories":["Porter"],"readme":"# Azure CLI Mixin for Porter\n\nThis is a mixin for Porter that provides the Azure (az) CLI.\n\n[![porter/az-mixin](https://github.com/getporter/az-mixin/actions/workflows/az-mixin.yml/badge.svg)](https://github.com/getporter/az-mixin/actions/workflows/az-mixin.yml)\n\n\u003cimg src=\"https://porter.sh/images/mixins/azure.png\" align=\"right\" width=\"150px\"/\u003e\n\n## Mixin Configuration\n\n### Client Version\nBy default, the most recent version of the az CLI is installed.\nYou can specify a specific version with the `clientVersion` setting.\n\n```yaml\nmixins:\n  - az:\n      clientVersion: 1.2.3\n```\n\n### Extensions\n\nWhen you declare the mixin, you can also configure additional extensions to install\n\n**Use the vanilla az CLI**\n```yaml\nmixins:\n- az\n```\n\n**Install additional extensions**\n\n```yaml\nmixins:\n- az:\n    extensions:\n    - EXTENSION_NAME\n```\n\n### User Agent Opt Out\n\nWhen you declare the mixin, you can disable the mixin from customizing the az user agent string\n\n```yaml\nmixins:\n- az:\n    userAgentOptOut: true\n```\n\nBy default, the az mixin adds the porter and mixin version to the user agent string used by the az CLI.\nWe use this to understand which version of porter and the mixin are being used by a bundle, and assist with troubleshooting.\nBelow is an example of what the user agent string looks like:\n\n```\nAZURE_HTTP_USER_AGENT=\"getporter/porter/v1.0.0 getporter/az/v1.2.3\"\n```\n\nYou can add your own custom strings to the user agent string by editing your [template Dockerfile] and setting the AZURE_HTTP_USER_AGENT environment variable.\n\n[template Dockerfile]: https://getporter.org/bundle/custom-dockerfile/\n\n### Install Bicep\n\nWhen you declare the mixin, you can also configure Bicep to be install\n\n```yaml\nmixins:\n- az:\n    installBicep: true\n```\n\nThis is required if you want to use the `az bicep` subcommands.\n\n## Mixin Syntax\n\nThe format below is for executing any arbitrary az CLI command.\n\nSee the [az CLI Command Reference](https://docs.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest) for the supported commands.\n\n```yaml\naz:\n  description: \"Description of the command\"\n  arguments: # arguments to pass to the az CLI\n  - arg1\n  - arg2\n  flags: # flags to pass to the az CLI, porter determines if it is a long (--flag) or short flag (-f)\n    a: flag-value\n    long-flag: true\n    repeated-flag:\n    - flag-value1\n    - flag-value2\n  suppress-output: false\n  ignoreError: # Conditions when execution should continue even if the command fails\n    all: true # Ignore all errors\n    exitCodes: # Ignore failed commands that return the following exit codes\n      - 1\n      - 2\n    output: # Ignore failed commands based on the contents of stderr\n      contains: # Ignore when stderr contains a substring\n        - \"SUBSTRING IN STDERR\"\n      regex: # Ignore when stderr matches a regular expression\n        - \"GOLANG_REGULAR_EXPRESSION\"\n  outputs: # Collect values from the command and make it available as an output\n    - name: NAME\n      jsonPath: JSONPATH # Scrape stdout with a json path expression\n    - name: NAME\n      regex: GOLANG_REGULAR_EXPRESSION # Scrape stdout with a regular expression\n    - name: NAME\n      path: FILEPATH # Save the contents of a file\n```\n\nNOTE: Some commands may not allow a flag to be repeated, and use a different\nsyntax such as packing all the values into a single flag instance. [Change\nSettings for a Web Application](#change-settings-for-a-web-application)\ndemonstrates how to handle inconsistent flags behavior.\n\n### Suppress Output\n\nThe `suppress-output` field controls whether output from the mixin should be\nprevented from printing to the console. By default this value is false, using\nPorter's default behavior of hiding known sensitive values. When \n`suppress-output: true` all output from the mixin (stderr and stdout) are hidden.\n\nStep outputs (below) are still collected when output is suppressed. This allows\nyou to prevent sensitive data from being exposed while still collecting it from\na command and using it in your bundle.\n\n### Ignore Error\n\nIn some cases, you may need to have the bundle continue executing when a command fails.\nFor example when the command fails because the resource already exists.\n\nYou can ignore errors based on:\n\n* All - Ignore all errors from the command.\n* ExitCodes - Ignore errors when one of the specified exit codes are returned.\n* Output Contains - Ignore errors when the command's stderr contains the specified string.\n* Output Regex - Ignore errors when the command's stderr matches the specified regular expression (in Go syntax).\n\nPorter only prints out that an error was ignored in debug mode.\n\n### Outputs\n\nThe mixin supports `jsonpath` and `path` outputs.\n\n\n#### JSON Path\n\nThe `jsonPath` output treats stdout like a json document and applies the expression, saving the result to the output.\n\n```yaml\noutputs:\n- name: NAME\n  jsonPath: JSONPATH\n```\n\nFor example, if the `jsonPath` expression was `$[*].id` and the command sent the following to stdout: \n\n```json\n[\n  {\n    \"id\": \"1085517466897181794\",\n    \"name\": \"my-vm\"\n  }\n]\n```\n\nThen then output would have the following contents:\n\n```json\n[\"1085517466897181794\"]\n```\n\n#### File Paths\n\nThe `path` output saves the content of the specified file path to an output.\n\n```yaml\noutputs:\n- name: kubeconfig\n  path: /root/.kube/config\n```\n\n---\n\n## Resource Groups\n\nThe mixin has a custom command to manage a resource group.\n\nWhen used in any action other than uninstall, the mixin will ensure that the resource group exists.\n```yaml\ninstall:\n  - az:\n      description: \"Ensure my group exists\"\n      group:\n        name: mygroup\n        location: westus\n```\n\nWhen used in the uninstall action, the mixin ensures that the resource group is deleted.\n```yaml\nuninstall:\n  - az:\n      description: \"Cleanup my group\"\n      group:\n        name: mygroup\n```\n\n## Examples\n\n### Install the Azure IoT Extension\n\n```yaml\nmixins:\n- az:\n    extensions:\n    - azure-cli-iot-ext\n```\n\n### Authenticate\n\nThe az mixin supports several authentication methods. All are provided with custom `login` command:\n\n```yaml\ninstall:\n  - az:\n      login:\n```\n\n### Existing Azure CLI Authentication\n\nIf you have already authenticated using `az login`, the mixin will use your\nexisting credentials. This requires the following files to exist in your\n`.azure` directory:\n- `azureProfile.json`: Contains your Azure profile information.\n- `msal_token_cache.json`: Contains the cached authentication tokens.\n\n### Service Principal Authentication\n\nTo authenticate using a service principal, set the following environment\nvariables:\n- `AZURE_CLIENT_ID`\n- `AZURE_CLIENT_SECRET`\n- `AZURE_TENANT_ID`\n\n### Managed Identity Authentication\n\nWhen running in Azure, you can authenticate using managed identity. By default,\nthe system-assigned managed identity is used. To use a user-assigned managed\nidentity, set the `AZURE_CLIENT_ID` environment variable to the client ID of\nthe managed identity.\n\n### Provision a VM\n\nCreate a VM, ignoring the error if it already exists.\n\n```yaml\naz:\n  description: \"Create VM\"\n  arguments:\n    - vm\n    - create\n  flags:\n    resource-group: porterci\n    name: myVM\n    image: UbuntuLTS\n  ignoreErrors:\n    output:\n      contains: [\"already exists\"]\n```\n\n### Delete a VM\n\nDelete a VM, ignoring the error if it has already been removed.\n\n```yaml\naz:\n  description: \"Delete VM\"\n  arguments:\n    - vm\n    - delete\n  flags:\n    resource-group: porterci\n    name: myVM\n  ignoreErrors:\n    output:\n      contains: [\"not found\"]\n```\n\n### Change Settings for a Web Application\n\nThe `--settings` flag for this command does not support being repeated. Instead you must pack all\nthe setting values into a single flag using space-separated KEY=VALUE pairs.\n\n```yaml\ninstall: \n  - az:\n      description: 'Deploy Web API configurations'\n      arguments:\n        - webapp\n        - config\n        - appsettings\n        - set\n      flags:\n        ids: '${ bundle.outputs.WEBAPI_ID }'\n        settings: 'PGHOST=${ bundle.outputs.POSTGRES_HOST } PGUSER=${ bundle.outputs.POSTGRES_USER } PGPASSWORD=${ bundle.outputs.POSTGRES_PASSWORD } PGDB=${ bundle.outputs.POSTGRES_DB }'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetporter%2Faz-mixin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetporter%2Faz-mixin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetporter%2Faz-mixin/lists"}