Skip to content

Commit 227ab35

Browse files
committed
final fixes
1 parent a9ed152 commit 227ab35

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

src/content/docs/azure/services/resource-manager.mdx

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ This guide is designed for users new to Resource Manager and assumes basic knowl
2424

2525
Launch LocalStack using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). Once the container is running, enable Azure CLI interception by running:
2626

27+
```bash
28+
azlocal start-interception
29+
```
30+
31+
This command points the `az` CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API.
32+
To revert this configuration, run:
33+
34+
```bash
35+
azlocal stop-interception
36+
```
37+
38+
This reconfigures the `az` CLI to send commands to the official Azure management REST API.
2739

2840
### Create a resource group
2941

@@ -123,6 +135,132 @@ az provider list --query "[?namespace=='Microsoft.Resources'].{namespace:namespa
123135
]
124136
```
125137

138+
### Deploy a Bicep template
139+
140+
Create a Bicep file named `main.bicep` that provisions a storage account inside the resource group:
141+
142+
```bicep
143+
param location string = resourceGroup().location
144+
param storageAccountName string = 'stbicep${uniqueString(resourceGroup().id)}'
145+
146+
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
147+
name: storageAccountName
148+
location: location
149+
sku: {
150+
name: 'Standard_LRS'
151+
}
152+
kind: 'StorageV2'
153+
}
154+
155+
output storageAccountId string = storageAccount.id
156+
```
157+
158+
Deploy the template into the resource group:
159+
160+
```bash
161+
az deployment group create \
162+
--resource-group rg-resources-demo \
163+
--template-file main.bicep
164+
```
165+
166+
```bash title="Output"
167+
{
168+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-resources-demo/providers/Microsoft.Resources/deployments/main",
169+
"name": "main",
170+
"properties": {
171+
"correlationId": "...",
172+
"mode": "Incremental",
173+
"provisioningState": "Succeeded",
174+
"outputResources": [
175+
{
176+
...
177+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-resources-demo/providers/Microsoft.Storage/storageAccounts/..."
178+
}
179+
],
180+
"outputs": {
181+
"storageAccountId": {
182+
"type": "String",
183+
"value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-resources-demo/providers/Microsoft.Storage/storageAccounts/..."
184+
}
185+
},
186+
"..."
187+
},
188+
"type": "Microsoft.Resources/deployments",
189+
"..."
190+
}
191+
```
192+
193+
Verify the deployment status:
194+
195+
```bash
196+
az deployment group show \
197+
--resource-group rg-resources-demo \
198+
--name main
199+
```
200+
201+
```bash title="Output"
202+
{
203+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-resources-demo/providers/Microsoft.Resources/deployments/main",
204+
"name": "main",
205+
"properties": {
206+
"correlationId": "...",
207+
"mode": "Incremental",
208+
"provisioningState": "Succeeded",
209+
...
210+
},
211+
"type": "Microsoft.Resources/deployments",
212+
"..."
213+
}
214+
```
215+
216+
## Features
217+
218+
The Resource Manager emulator supports the following features:
219+
220+
- **Resource group lifecycle**: Create, update, get, list, delete, and check existence of resource groups. Deletion cascades to all contained resources.
221+
- **Resource listing and filtering**: List resources across a subscription or within a resource group, with support for `$filter` and `$expand` query parameters.
222+
- **Resource move**: Move top-level resources between resource groups with validation of source and destination groups, resource locks, and resource hierarchy.
223+
- **ARM template deployments**: Create or update deployments at the resource group scope and at the subscription scope. Templates are parsed and resources are provisioned in dependency order.
224+
- **Bicep support**: Bicep files compiled by the Azure CLI are accepted as ARM JSON templates. The emulator handles Bicep 2.0 symbolic names, `languageVersion`, and `definitions` sections.
225+
- **Nested deployments**: Inner-scoped and outer-scoped nested templates (`Microsoft.Resources/deployments`) are supported, including parameter passing between scopes.
226+
- **ARM template functions**: Over 60 built-in functions are evaluated locally, including `resourceId`, `reference`, `listKeys`, `concat`, `format`, `uniqueString`, `resourceGroup`, `subscription`, `copyIndex`, `if`, `union`, `createObject`, and others.
227+
- **Template validation**: Validate ARM templates at the resource group scope and subscription scope without creating resources.
228+
- **Copy loops and conditional resources**: The `copy` element and `condition` property are supported, enabling iterative resource creation and conditional deployment logic.
229+
- **Deployment operations**: List deployment operations at the resource group scope and at the subscription scope, including provisioning state and target resource details.
230+
- **Deployment outputs**: Template outputs are evaluated after deployment completes, with full ARM expression resolution.
231+
- **Subscription management**: List and get subscriptions, and list available Azure locations with metadata.
232+
- **Tenant listing**: List tenant identifiers associated with the emulator environment.
233+
- **Provider registry**: List, get, register, and unregister resource providers, including resource type details, API versions, and zone mappings.
234+
- **Resource group locks**: Lock and unlock resource groups to prevent accidental deletion or modification of contained resources.
235+
236+
## Limitations
237+
238+
- **Single subscription**: The emulator exposes a single subscription. Multiple subscriptions are not supported.
239+
- **Template validation is a no-op**: The `deployments validate` and `deployments validate at subscription scope` endpoints return a success response without performing syntactic or semantic validation.
240+
- **No management group or tenant-scoped deployments**: Deployments are supported only at the resource group and subscription scopes.
241+
- **No what-if analysis**: The `az deployment group what-if` operation is not implemented.
242+
- **ARM template function coverage**: While over 60 functions are supported, some less common functions or advanced overloads may not be fully implemented.
243+
- **No resource tags on generic resource listings**: Tags and extended properties may not be fully populated when listing resources across a subscription.
244+
- **No RBAC enforcement on resource operations**: All API calls succeed without role-based access control checks.
245+
- **Deployment concurrency**: Resources within a single deployment are created sequentially with dependency resolution, not in full parallel as in Azure.
246+
- **No deployment cancellation**: Running deployments cannot be cancelled.
247+
- **No deployment deletion**: Deployments are retained in memory and cannot be explicitly deleted via the API.
248+
249+
## Samples
250+
251+
The following samples demonstrate how to use Azure Resource Manager and Bicep with LocalStack for Azure:
252+
253+
- [Function App and Storage](https://github.com/localstack/localstack-azure-samples/tree/main/samples/function-app-storage-http/dotnet/)
254+
- [Function App and Front Door](https://github.com/localstack/localstack-azure-samples/tree/main/samples/function-app-front-door/python/)
255+
- [Function App and Managed Identities](https://github.com/localstack/localstack-azure-samples/tree/main/samples/function-app-managed-identity/python/)
256+
- [Function App and Service Bus](https://github.com/localstack/localstack-azure-samples/tree/main/samples/function-app-service-bus/dotnet/)
257+
- [Web App and Cosmos DB for MongoDB API](https://github.com/localstack/localstack-azure-samples/tree/main/samples/web-app-cosmosdb-mongodb-api/python/)
258+
- [Web App and Cosmos DB for NoSQL API](https://github.com/localstack/localstack-azure-samples/tree/main/samples/web-app-cosmosdb-nosql-api/python/)
259+
- [Web App and Managed Identities](https://github.com/localstack/localstack-azure-samples/tree/main/samples/web-app-managed-identity/python/)
260+
- [Web App and SQL Database](https://github.com/localstack/localstack-azure-samples/tree/main/samples/web-app-sql-database/python/)
261+
- [ACI and Blob Storage](https://github.com/localstack/localstack-azure-samples/tree/main/samples/aci-blob-storage/python/)
262+
- [Azure Service Bus with Spring Boot](https://github.com/localstack/localstack-azure-samples/tree/main/samples/servicebus/java/)
263+
126264
## API Coverage
127265

128266
<AzureFeatureCoverage service="Microsoft.Resources" client:load />

0 commit comments

Comments
 (0)