Skip to content

Commit 1014bfe

Browse files
committed
Refresh article
1 parent 8f01607 commit 1014bfe

1 file changed

Lines changed: 45 additions & 33 deletions

File tree

articles/container-apps/microservices-dapr.md

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
2-
title: "Quickstart: Deploy a Dapr application to Azure Container Apps using the Azure CLI"
3-
description: Deploy a Dapr application to Azure Container Apps using the Azure CLI.
2+
title: "Quickstart: Deploy a Dapr App using the Azure CLI"
3+
description: Learn how to deploy a Dapr application to Azure Container Apps by using the Azure CLI.
44
services: container-apps
55
author: greenie-msft
66
ms.service: azure-container-apps
77
ms.subservice: dapr
88
ms.topic: quickstart
9-
ms.date: 02/03/2025
9+
ms.date: 01/29/2026
1010
ms.author: nigreenf
1111
ms.reviewer: hannahhunter
1212
ms.custom: devx-track-azurecli, devx-track-azurepowershell
1313
ms.devlang: azurecli
1414
---
1515

16-
# Quickstart: Deploy a Dapr application to Azure Container Apps using the Azure CLI
16+
# Quickstart: Deploy a Dapr application to Azure Container Apps by using the Azure CLI
1717

1818
[Dapr](./dapr-overview.md) (Distributed Application Runtime) helps developers build resilient, reliable microservices. In this quickstart, you learn how to enable Dapr sidecars to run alongside your microservices container apps. You'll:
1919

@@ -27,6 +27,13 @@ ms.devlang: azurecli
2727

2828
This quickstart mirrors the applications you deploy in the open-source Dapr [Hello World](https://github.com/dapr/quickstarts/tree/master/tutorials/hello-world) quickstart.
2929

30+
## Prerequisites
31+
32+
- An Azure account with an active subscription. If you don't already have one, you can [create an account for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
33+
- A GitHub account. If you don't already have one, sign up for [free](https://github.com/join).
34+
- Install [Azure CLI](/cli/azure/install-azure-cli).
35+
- Install [Git](https://git-scm.com/downloads).
36+
3037
[!INCLUDE [container-apps-create-cli-steps.md](../../includes/container-apps-create-cli-steps.md)]
3138

3239
[!INCLUDE [container-apps-set-environment-variables.md](../../includes/container-apps-set-environment-variables.md)]
@@ -39,18 +46,20 @@ This quickstart mirrors the applications you deploy in the open-source Dapr [Hel
3946

4047
### Create an Azure Blob Storage account
4148

42-
With the environment deployed, deploy an Azure Blob Storage account that is used by the Node.js container app to store data. Before deploying the service, choose a name for the storage account. Storage account names must be _unique within Azure_, from 3 to 24 characters in length and must contain numbers and lowercase letters only.
49+
With the environment deployed, deploy an Azure Blob Storage account that is used by the Node.js container app to store data. Before deploying the service, choose a name for the storage account.
50+
51+
Storage account names must be _unique within Azure_, from 3 to 24 characters in length and must contain numbers and lowercase letters only.
4352

4453
# [Bash](#tab/bash)
4554

4655
```azurecli
47-
STORAGE_ACCOUNT_NAME="<storage account name>"
56+
STORAGE_ACCOUNT_NAME="<storage-account-name>"
4857
```
4958

5059
# [PowerShell](#tab/powershell)
5160

5261
```azurepowershell
53-
$StorageAcctName = '<storage account name>'
62+
$StorageAcctName = '<storage-account-name>'
5463
```
5564

5665
---
@@ -63,7 +72,7 @@ Use the following command to create the Azure Storage account.
6372
az storage account create \
6473
--name $STORAGE_ACCOUNT_NAME \
6574
--resource-group $RESOURCE_GROUP \
66-
--location "$LOCATION" \
75+
--location $LOCATION \
6776
--sku Standard_RAGRS \
6877
--kind StorageV2
6978
```
@@ -80,6 +89,7 @@ $StorageAcctArgs = @{
8089
SkuName = 'Standard_RAGRS'
8190
Kind = 'StorageV2'
8291
}
92+
8393
$StorageAccount = New-AzStorageAccount @StorageAcctArgs
8494
```
8595

@@ -94,15 +104,15 @@ While Container Apps supports both user-assigned and system-assigned managed ide
94104
# [Bash](#tab/bash)
95105

96106
```azurecli
97-
az identity create --resource-group $RESOURCE_GROUP --name "nodeAppIdentity" --output json
107+
az identity create --resource-group $RESOURCE_GROUP --name "nodeAppIdentity" --output json
98108
```
99109
100110
# [PowerShell](#tab/powershell)
101111
102112
```azurepowershell
103113
Install-Module -Name AZ.ManagedServiceIdentity
104114
105-
New-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity' -Location $Location
115+
New-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity' -Location $Location
106116
107117
```
108118
@@ -113,17 +123,17 @@ While Container Apps supports both user-assigned and system-assigned managed ide
113123
# [Bash](#tab/bash)
114124
115125
```azurecli
116-
PRINCIPAL_ID=$(az identity show -n "nodeAppIdentity" --resource-group $RESOURCE_GROUP --query principalId | tr -d \")
117-
IDENTITY_ID=$(az identity show -n "nodeAppIdentity" --resource-group $RESOURCE_GROUP --query id | tr -d \")
118-
CLIENT_ID=$(az identity show -n "nodeAppIdentity" --resource-group $RESOURCE_GROUP --query clientId | tr -d \")
126+
PRINCIPAL_ID=$(az identity show -n "nodeAppIdentity" --resource-group $RESOURCE_GROUP --query principalId | tr -d \")
127+
IDENTITY_ID=$(az identity show -n "nodeAppIdentity" --resource-group $RESOURCE_GROUP --query id | tr -d \")
128+
CLIENT_ID=$(az identity show -n "nodeAppIdentity" --resource-group $RESOURCE_GROUP --query clientId | tr -d \")
119129
```
120130
121131
# [PowerShell](#tab/powershell)
122132
123133
```azurepowershell
124-
$PrincipalId = (Get-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity').PrincipalId
125-
$IdentityId = (Get-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity').Id
126-
$ClientId = (Get-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity').ClientId
134+
$PrincipalId = (Get-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity').PrincipalId
135+
$IdentityId = (Get-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity').Id
136+
$ClientId = (Get-AzUserAssignedIdentity -ResourceGroupName $ResourceGroupName -Name 'nodeAppIdentity').ClientId
127137
```
128138
129139
---
@@ -151,15 +161,15 @@ While Container Apps supports both user-assigned and system-assigned managed ide
151161
```azurecli
152162
az role assignment create --assignee $PRINCIPAL_ID \
153163
--role "Storage Blob Data Contributor" \
154-
--scope "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/ Microsoft.Storage/storageAccounts/$STORAGE_ACCOUNT_NAME"
164+
--scope "subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.Storage/storageAccounts/$STORAGE_ACCOUNT_NAME"
155165
```
156166
157167
# [PowerShell](#tab/powershell)
158168
159169
```azurepowershell
160170
Install-Module Az.Resources
161171
162-
New-AzRoleAssignment -ObjectId $PrincipalId -RoleDefinitionName 'Storage Blob Data Contributor' -Scope "/subscriptions/$SubscriptionId/resourceGroups/ $ResourceGroupName/providers/Microsoft.Storage/storageAccounts/$StorageAcctName"
172+
New-AzRoleAssignment -ObjectId $PrincipalId -RoleDefinitionName 'Storage Blob Data Contributor' -Scope "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Storage/storageAccounts/$StorageAcctName"
163173
```
164174
165175
---
@@ -168,19 +178,19 @@ While Container Apps supports both user-assigned and system-assigned managed ide
168178
169179
While you have multiple options for authenticating to external resources via Dapr. This example uses an Azure-based state store, so you can provide direct access from the Node.js app to the Blob store using Managed Identity.
170180
171-
1. In a text editor, create a file named *statestore.yaml* with the properties that you sourced from the previous steps.
181+
1. In a text editor, create a file named *statestore.yaml* with the properties that you sourced from the previous steps. Replace the `<placeholders>` with your values.
172182
173183
```yaml
174184
# statestore.yaml for Azure Blob storage component
175185
componentType: state.azure.blobstorage
176186
version: v1
177187
metadata:
178188
- name: accountName
179-
value: "<STORAGE_ACCOUNT_NAME>"
189+
value: "<storage-account-name>"
180190
- name: containerName
181191
value: mycontainer
182192
- name: azureClientId
183-
value: "<MANAGED_IDENTITY_CLIENT_ID>"
193+
value: "<managed-identity-client-ID>"
184194
scopes:
185195
- nodeapp
186196
```
@@ -202,11 +212,11 @@ While you have multiple options for authenticating to external resources via Dap
202212
203213
```azurepowershell
204214
205-
$AcctName = New-AzContainerAppDaprMetadataObject -Name "accountName" -Value $StorageAcctName
215+
$AcctName = New-AzContainerAppDaprMetadataObject -Name "accountName" -Value $StorageAcctName
206216
207-
$ContainerName = New-AzContainerAppDaprMetadataObject -Name "containerName" -Value 'mycontainer'
217+
$ContainerName = New-AzContainerAppDaprMetadataObject -Name "containerName" -Value 'mycontainer'
208218
209-
$ClientId = New-AzContainerAppDaprMetadataObject -Name "azureClientId" -Value $ClientId
219+
$ClientId = New-AzContainerAppDaprMetadataObject -Name "azureClientId" -Value $ClientId
210220
211221
$DaprArgs = @{
212222
EnvName = $ContainerAppsEnvironment
@@ -256,6 +266,7 @@ $TemplateArgs = @{
256266
Image = 'dapriosamples/hello-k8s-node:latest'
257267
Env = $EnvVars
258268
}
269+
259270
$ServiceTemplateObj = New-AzContainerAppTemplateObject @TemplateArgs
260271
261272
$ServiceArgs = @{
@@ -274,6 +285,7 @@ $ServiceArgs = @{
274285
$IdentityId = @{}
275286
}
276287
}
288+
277289
New-AzContainerApp @ServiceArgs
278290
```
279291

@@ -312,7 +324,6 @@ $TemplateArgs = @{
312324
313325
$ClientTemplateObj = New-AzContainerAppTemplateObject @TemplateArgs
314326
315-
316327
$ClientArgs = @{
317328
Name = 'pythonapp'
318329
ResourceGroupName = $ResourceGroupName
@@ -324,6 +335,7 @@ $ClientArgs = @{
324335
DaprEnabled = $true
325336
DaprAppId = 'pythonapp'
326337
}
338+
327339
New-AzContainerApp @ClientArgs
328340
```
329341

@@ -351,9 +363,9 @@ You can confirm that the services are working correctly by viewing data in your
351363

352364
1. Select the **Refresh** button to observe how the data automatically updates.
353365

354-
### View Logs
366+
### View logs
355367

356-
Logs from container apps are stored in the `ContainerAppConsoleLogs_CL` custom table in the Log Analytics workspace. You can view logs through the Azure portal or via the CLI. There may be a small delay initially for the table to appear in the workspace.
368+
Logs from container apps are stored in the `ContainerAppConsoleLogs_CL` custom table in the Log Analytics workspace. You can view logs through the Azure portal or via the CLI. There might be a small delay initially for the table to appear in the workspace.
357369

358370
View logs using the command line using the following CLI command.
359371

@@ -372,7 +384,8 @@ az monitor log-analytics query \
372384

373385
```azurepowershell
374386
375-
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WorkspaceId -Query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == 'nodeapp' and (Log_s contains 'persisted' or Log_s contains 'order') | project ContainerAppName_s, Log_s, TimeGenerated | take 5 "
387+
$queryResults = Invoke-AzOperationalInsightsQuery -WorkspaceId $WorkspaceId -Query "ContainerAppConsoleLogs_CL | where ContainerAppName_s == 'nodeapp' and (Log_s contains 'persisted' or Log_s contains 'order') | project ContainerAppName_s, Log_s, TimeGenerated | take 5 "
388+
376389
$queryResults.Results
377390
378391
```
@@ -393,12 +406,12 @@ nodeapp Got a new order! Order ID: 63 PrimaryResult 2021-10-22
393406

394407
## Clean up resources
395408

396-
Since `pythonapp` continuously makes calls to `nodeapp` with messages that get persisted into your configured state store, it is important to complete these cleanup steps to avoid ongoing billable operations.
409+
Since `pythonapp` continuously makes calls to `nodeapp` with messages that get persisted into your configured state store, it's important to complete these cleanup steps to avoid ongoing billable operations.
397410

398411
If you'd like to delete the resources created as a part of this walkthrough, run the following command.
399412

400413
> [!CAUTION]
401-
> This command deletes the specified resource group and all resources contained within it. If resources outside the scope of this tutorial exist in the specified resource group, they will also be deleted.
414+
> This command deletes the specified resource group and all resources contained within it. If resources outside the scope of this tutorial exist in the specified resource group, they're also deleted.
402415
403416
# [Bash](#tab/bash)
404417

@@ -414,11 +427,10 @@ Remove-AzResourceGroup -Name $ResourceGroupName -Force
414427

415428
---
416429

417-
418430
> [!TIP]
419431
> Having issues? Let us know on GitHub by opening an issue in the [Azure Container Apps repo](https://github.com/microsoft/azure-container-apps).
420432
421-
## Next steps
433+
## Next step
422434

423435
> [!div class="nextstepaction"]
424-
> [Learn more about Dapr components in Azure Container Apps](dapr-components.md)
436+
> [Learn about Dapr components in Azure Container Apps](dapr-components.md)

0 commit comments

Comments
 (0)