# Azure CLI

## Account management defaults

### Set subscription by name

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

### Get subscription ID of current account

```bash
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:

```bash
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:

```javascript
{
  "$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

```bash
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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cookbook.geuer-pollmann.de/azure/azure-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
