# CLI/Powershell

## Install on ubuntu

```
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
```

## az account

### List accounts

```bash
az account list
```

### List locations

```bash
az account list-locations
```

### Set account

```bash
az account set --subscription "YOUR SUBSCRIPTION"
```

## az network

### Get subnet ID

```
az network vnet subnet show -g YOUR-RG -n YOUR-SUBNET --vnet-name YOUR-VNET -otsv
```

## az resource

### List all resources

```bash
az resource list
```

```bash
Get-AzureRmResource
```

## az vm

### Force stop

```bash
az vm stop --resource-group YOUR-RG --name YOUR-VM-NAME --skip-shutdown
```

### Start

```bash
az vm start --resource-group YOUR-RG --name YOUR-VM-NAME
```

## Get object by ID

```bash
Get-AzureADObjectByObjectId -ObjectIds a183a290-4fa6-4a8f-b406-033429ec7119
```


---

# 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://www.devops.buzz/public/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.
