Skip to content

Instantly share code, notes, and snippets.

@stuartleeks
Last active July 5, 2018 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartleeks/21eca29239d0a4d7a86961f9971c1362 to your computer and use it in GitHub Desktop.
Save stuartleeks/21eca29239d0a4d7a86961f9971c1362 to your computer and use it in GitHub Desktop.
.azure/alias
[group-kill {{rg}}]
command = group delete -g {{rg}} --yes --no-wait
[get-subscription-id]
command = account show --query id -o tsv
#subscriptionId=$(az get-subscription-id)
[deployment-operation-summary {{rg}} {{name}}]
command = group deployment operation list -g {{rg}} -n {{name}} --query "[].{operationId:operationId, state:properties.provisioningState, resourceType: properties.targetResource.resourceType, resourceName:properties.targetResource.resourceName}"
[create-spn-for-subscription {{subscriptionId}}]
command = ad sp create-for-rbac --role="Contributor" --scope="/subscriptions/{{subscriptionId}}" --query "{clientId:name, secret:password}"
[create-spn-for-resource-group {{subscriptionId}} {{rg}}]
command = ad sp create-for-rbac --role="Contributor" --scope="/subscriptions/{{subscriptionId}}/resourceGroups/{{rg}}" --query "{clientId:name, secret:password}"
# [test]
# command = az group list
#[test {{foo}}]
#command = az group {% if foo == "" %} list {% else %} show --name {{foo}} {% endif %}
[get-storage-key {{rg}} {{account}}]
command = storage account keys list --resource-group {{rg}} --account-name {{account}} --output tsv --query "[0].value"
[get-principal-id-for-resource {{resourceName}}]
command = resource list --name {{resourceName}} --query [*].identity.principalId -o tsv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment