cookbook.geuer-pollmann.de
  • Introduction
  • Command line utilities
    • bash scripting
    • cURL command line utility
    • ffmpeg - Processing Media
    • JOSE from the command line
    • jq
    • Misc. command line tools
    • Zettelkasten / Markdown
  • Azure
    • Logging in to Azure
    • Working with the REST API
    • Tracing HTTP requests with Fiddler
    • Upload a file from bash
    • Azure CLI
    • terraform
    • Azure Logic Apps
    • Azure Web Apps
    • Azure Python code snippets
    • SSH keys in ARM
    • Minimal "Azure AD Workload identity federation"
    • Federated credentials from GitHub and GitLab pipelines to Azure
    • Azure Marketplace Metered Billing- Picking the correct ID when submitting usage events
    • Manually submitting values to the Azure Metering API
    • How can a publisher/ISV access the data plane of an Azure managed application?
    • The checkZonePeers API: Is your availability zone "1" equal to my "1"?
    • Token authentication with "Azure Verizon Premium CDN"
    • Getting the right storage container name in a Bicep template
    • Event-sourcing into working memory to improve data access latency
    • Postgrex on Azure - Connecting to Azure PostgreSQL from Elixir
  • Productivity
    • Excel
    • Desktop Setup
    • Time handling and Scheduling
    • Elgato from the shell
    • Typora
Powered by GitBook
On this page
  • Account management defaults
  • Set subscription by name
  • Get subscription ID of current account
  • Create an ARM deployment and pass in a parameter of type 'object'
  • Run the Docker container
Edit on GitHub
  1. Azure

Azure CLI

Account management defaults

Set subscription by name

subscriptionName="chgeuer-work"
az account set --subscription "${subscriptionName}"

Get subscription ID of current account

subscriptionID="$( az account show --output json | jq -r ".id" )"

Create an ARM deployment and pass in a parameter of type 'object'

The file definition.json contains a JSON object, which is passed as-is into the ARM deployment:

resourceGroup="foo"
logicAppName="someapp"

deploymentResult="$( az group deployment create \
  --resource-group "${resourceGroup}" \
  --mode Incremental \
  --template-file ./azuredeploy-minimal.json \
  --parameters logicAppName="${logicAppName}" \
  --parameters logicAppDefinition="@./definition.json" 
  )"

The template has a corresponding type=object parameter:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": { "type": "string", "defaultValue": "..." },
    "logicAppDefinition": { "type": "object" }
  },
  ...
}

Run the Docker container

docker pull mcr.microsoft.com/azure-cli:latest

docker run --mount "src=${HOME}/.azure,target=/root/.azure,type=bind" -it --rm mcr.microsoft.com/azure-cli:latest
PreviousUpload a file from bashNextterraform

Last updated 1 year ago