|
| 1 | +--- |
| 2 | +title: Quickstart |
| 3 | +description: Get started with LocalStack for Azure in a few simple steps. |
| 4 | +template: doc |
| 5 | +sidebar: |
| 6 | + order: 1 |
| 7 | +--- |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +This guide explains how to set up the Azure emulator and interact with it using the [`az` CLI](https://learn.microsoft.com/en-us/cli/azure/). |
| 12 | +In this guide, you will run some basic Azure CLI commands to manage resource groups in an local Azure development environment without connecting to the real cloud services. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +- [`localstack` CLI](/aws/getting-started/installation/#localstack-cli) |
| 17 | +- [`azlocal` CLI](https://pypi.org/project/azlocal/) |
| 18 | +- [LocalStack for Azure](/azure/getting-started/) |
| 19 | + |
| 20 | +## Instructions |
| 21 | + |
| 22 | +Before you begin, make sure that the Emulator is running, see the [installation instructions](/azure/getting-started/). |
| 23 | + |
| 24 | +### Setup the `azlocal` tool |
| 25 | + |
| 26 | +To instruct the regular `az` CLI tool to communicate with the Azure emulator, run the following command: |
| 27 | + |
| 28 | +``` |
| 29 | +$ azlocal start_interception |
| 30 | +``` |
| 31 | + |
| 32 | +You may see some warnings about experimental commands, you can safely ignore these. |
| 33 | + |
| 34 | +### Create a resource group |
| 35 | + |
| 36 | +To create a resource group, you can now the same `az` command as you would normally: |
| 37 | + |
| 38 | +``` |
| 39 | +$ az group create --name MyResourceGroup --location westeurope |
| 40 | +``` |
| 41 | + |
| 42 | +The following output would be displayed: |
| 43 | + |
| 44 | +```bash |
| 45 | +{ |
| 46 | + "id": "/subscriptions/some-generated-id/resourceGroups/MyResourceGroup", |
| 47 | + "location": "westeurope", |
| 48 | + "managedBy": null, |
| 49 | + "name": "MyResourceGroup", |
| 50 | + "properties": { |
| 51 | + "provisioningState": "Succeeded" |
| 52 | + }, |
| 53 | + "tags": null, |
| 54 | + "type": "Microsoft.Resources/resourceGroups" |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +### Check & list resource groups |
| 59 | + |
| 60 | +To check the resource group details, run the following command: |
| 61 | + |
| 62 | +``` |
| 63 | +$ az group show --name MyResourceGroup |
| 64 | +``` |
| 65 | + |
| 66 | +To list all the resource groups, run the following command: |
| 67 | + |
| 68 | +``` |
| 69 | +$ azlocal group list |
| 70 | +``` |
| 71 | + |
| 72 | +### Delete the resource group |
| 73 | + |
| 74 | +To delete the resource group, run the following command: |
| 75 | + |
| 76 | +``` |
| 77 | +$ az group delete --name MyResourceGroup --yes |
| 78 | +``` |
| 79 | + |
| 80 | +### Teardown |
| 81 | + |
| 82 | +When you're done using the Azure Emulator, you can run the following command: |
| 83 | + |
| 84 | +``` |
| 85 | +$ azlocal stop_interception |
| 86 | +``` |
| 87 | + |
| 88 | +All invocations of the `az` CLI tool will now talk to the real Azure Cloud again. |
0 commit comments