You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/managed-identity.md
+18-12Lines changed: 18 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -350,11 +350,16 @@ To get a token for a resource, make an HTTP `GET` request to the endpoint, inclu
350
350
351
351
---
352
352
353
-
## Use managed identity for scale rules
353
+
## <a name="scale-rules"></a>Use managed identity for scale rules
354
354
355
-
Starting in API version `2024-02-02-preview`, you can use managed identities in your scale rules to authenticate with Azure services that support managed identities. To use a managed identity in your scale rule, use the `identity` property instead of the `auth` property in your scale rule. Acceptable values for the `identity` property are either the Azure resource ID of a user-assigned identity, or `system` to use a system-assigned identity
355
+
You can use managed identities in your scale rules to authenticate with Azure services that support managed identities. To use a managed identity in your scale rule, use the `identity` property instead of the `auth` property in your scale rule. Acceptable values for the `identity` property are either the Azure resource ID of a user-assigned identity, or `system` to use a system-assigned identity.
356
356
357
-
The following example shows how to use a managed identities with an Azure Queue Storage scale rule. The queue storage account uses the `accountName` property to identify the storage account, while the `identity` property specifies which managed identity to use. You do not need to use the `auth` property.
357
+
> [!NOTE]
358
+
> Managed identity authentication in scale rules is in public preview. It's available in API version `2024-02-02-preview`.
359
+
360
+
The following ARM template example shows how to use a managed identity with an Azure Queue Storage scale rule:
361
+
362
+
The queue storage account uses the `accountName` property to identify the storage account, while the `identity` property specifies which managed identity to use. You do not need to use the `auth` property.
358
363
359
364
```json
360
365
"scale": {
@@ -371,19 +376,20 @@ The following example shows how to use a managed identities with an Azure Queue
371
376
}]
372
377
}
373
378
```
379
+
To learn more about using managed identity with scale rules, see [Set scaling rules in Azure Container Apps](scale-app.md?pivots=azure-portal#authentication-2).
374
380
375
381
## Control managed identity availability
376
382
377
-
Container Apps allow you to specify [init containers](containers.md#init-containers) and main containers. By default, both main and init containers in a consumption workload profile environment can use managed identity to access other Azure services. In consumption-only environments and dedicated workload profile environments, only main containers can use managed identity. Managed identity access tokens are available for every managed identity configured on the container app. However, in some situations only the init container or the main container require access tokens for a managed identity. Other times, you may use a managed identity only to access your Azure Container Registry to pull the container image, and your application itself doesn't need to have access to your Azure Container Registry.
383
+
Container Apps allows you to specify [init containers](containers.md#init-containers) and main containers. By default, both main and init containers in a consumption workload profile environment can use managed identity to access other Azure services. In consumption-only environments and dedicated workload profile environments, only main containers can use managed identity. Managed identity access tokens are available for every managed identity configured on the container app. However, in some situations only the init container or the main container require access tokens for a managed identity. Other times, you may use a managed identity only to access your Azure Container Registry to pull the container image, and your application itself doesn't need to have access to your Azure Container Registry.
378
384
379
385
Starting in API version `2024-02-02-preview`, you can control which managed identities are available to your container app during the init and main phases to follow the security principle of least privilege. The following options are available:
380
386
381
-
- `Init`: available only to init containers. Use this when you want to perform some intilization work that requires a managed identity, but you no longer need the managed identity in the main container. This option is currently only supported in [workload profile consumption environments](environment.md#types)
382
-
- `Main`: available only to main containers. Use this if your init container does not need managed identity.
383
-
- `All`: available to all containers. This is the default setting.
384
-
- `None`: not available to any containers. Use this when you have a managed identity that is only used for ACR image pull, scale rules, or Key Vault secrets and does not need to be available to the code running in your containers.
387
+
- `Init`: Available only to init containers. Use this when you want to perform some initialization work that requires a managed identity, but you no longer need the managed identity in the main container. This option is currently only supported in [workload profile consumption environments](environment.md#types)
388
+
- `Main`: Available only to main containers. Use this if your init container does not need managed identity.
389
+
- `All`: Available to all containers. This value is the default setting.
390
+
- `None`: Not available to any containers. Use this when you have a managed identity that is only used for ACR image pull, scale rules, or Key Vault secrets and does not need to be available to the code running in your containers.
385
391
386
-
The following example shows how to configure a container app on a workload profile consumption environment that:
392
+
The following ARM template example shows how to configure a container app on a workload profile consumption environment that:
387
393
388
394
- Restricts the container app's system-assigned identity to main containers only.
389
395
- Restricts a specific user-assigned identity to init containers only.
@@ -413,15 +419,15 @@ This approach limits the resources that can be accessed if a malicious actor wer
Copy file name to clipboardExpand all lines: articles/container-apps/scale-app.md
+64-10Lines changed: 64 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,7 +247,7 @@ The following example demonstrates how to create a custom scale rule.
247
247
248
248
This example shows how to convert an [Azure Service Bus scaler](https://keda.sh/docs/latest/scalers/azure-service-bus/) to a Container Apps scale rule, but you use the same process for any other [ScaledObject](https://keda.sh/docs/latest/concepts/scaling-deployments/)-based [KEDA scaler](https://keda.sh/docs/latest/scalers/) specification.
249
249
250
-
For authentication, KEDA scaler authentication parameters convert into [Container Apps secrets](manage-secrets.md).
250
+
For authentication, KEDA scaler authentication parameters take [Container Apps secrets](manage-secrets.md) or [managed identity](managed-identity.md#scale-rules).
251
251
252
252
::: zone pivot="azure-resource-manager"
253
253
@@ -319,10 +319,13 @@ First, you define the type and metadata of the scale rule.
319
319
320
320
### Authentication
321
321
322
-
A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.sh/docs/latest/concepts/authentication/) that is referenced by the `authenticationRef` property. You can map the TriggerAuthentication object to the Container Apps scale rule.
322
+
Container Apps scale rules support secrets-based authentication. Scale rules for Azure resources, including Azure Queue Storage, Azure Service Bus, and Azure Event Hubs, also support managed identity. Where possible, use managed identity authentication to avoid storing secrets within the app.
323
323
324
-
> [!NOTE]
325
-
> Container Apps scale rules only support secret references. Other authentication types such as pod identity are not supported.
324
+
#### Use secrets
325
+
326
+
To use secrets for authentication, you need to create a secret in the container app's `secrets` array. The secret value is used in the `auth` array of the scale rule.
327
+
328
+
KEDA scalers can use secrets in a [TriggerAuthentication](https://keda.sh/docs/latest/concepts/authentication/) that is referenced by the `authenticationRef` property. You can map the TriggerAuthentication object to the Container Apps scale rule.
326
329
327
330
1. Find the `TriggerAuthentication` object referenced by the KEDA `ScaledObject` specification.
328
331
@@ -344,6 +347,33 @@ A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.s
344
347
345
348
Refer to the [considerations section](#considerations) for more security related information.
346
349
350
+
#### Using managed identity
351
+
352
+
Container Apps scale rules can use managed identity to authenticate with Azure services. The following ARM template passes in system-based managed identity to authenticate for an Azure Queue scaler.
353
+
354
+
```
355
+
"scale": {
356
+
"minReplicas": 0,
357
+
"maxReplicas": 4,
358
+
"rules": [
359
+
{
360
+
"name": "azure-queue",
361
+
"custom": {
362
+
"type": "azure-queue",
363
+
"metadata": {
364
+
"accountName": "apptest123",
365
+
"queueName": "queue1",
366
+
"queueLength": "1"
367
+
},
368
+
"identity": "system"
369
+
}
370
+
}
371
+
]
372
+
}
373
+
```
374
+
375
+
To learn more about using managed identity with scale rules, see [Managed identity](managed-identity.md#scale-rules).
376
+
347
377
::: zone-end
348
378
349
379
::: zone pivot="azure-cli"
@@ -368,10 +398,13 @@ A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.s
368
398
369
399
### Authentication
370
400
371
-
A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.sh/docs/latest/concepts/authentication/) that is referenced by the authenticationRef property. You can map the TriggerAuthentication object to the Container Apps scale rule.
401
+
Container Apps scale rules support secrets-based authentication. Scale rules for Azure resources, including Azure Queue Storage, Azure Service Bus, and Azure Event Hubs, also support managed identity. Where possible, use managed identity authentication to avoid storing secrets within the app.
372
402
373
-
> [!NOTE]
374
-
> Container Apps scale rules only support secret references. Other authentication types such as pod identity are not supported.
403
+
#### Use secrets
404
+
405
+
To configure secrets-based authentication for a Container Apps scale rule, you configure the secrets in the container app and reference them in the scale rule.
406
+
407
+
A KEDA scaler supports secrets in a [TriggerAuthentication](https://keda.sh/docs/latest/concepts/authentication/) which the `authenticationRef` property uses for reference. You can map the `TriggerAuthentication` object to the Container Apps scale rule.
375
408
376
409
1. Find the `TriggerAuthentication` object referenced by the KEDA `ScaledObject` specification. Identify each `secretTargetRef` of the `TriggerAuthentication` object.
377
410
@@ -386,6 +419,24 @@ A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.s
386
419
1. Create an authentication entry with the `--scale-rule-auth` parameter. If there are multiple entries, separate them with a space.
Container Apps scale rules can use managed identity to authenticate with Azure services. The following command creates a container app with a user-assigned managed identity and uses it to authenticate for an Azure Queue scaler.
@@ -423,10 +474,9 @@ A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.s
423
474
424
475
### Authentication
425
476
426
-
A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.sh/docs/latest/concepts/authentication/) that is referenced by the authenticationRef property. You can map the TriggerAuthentication object to the Container Apps scale rule.
477
+
Container Apps scale rules support secrets-based authentication. Scale rules for Azure resources, including Azure Queue Storage, Azure Service Bus, and Azure Event Hubs, also support managed identity. Where possible, use managed identity authentication to avoid storing secrets within the app.
427
478
428
-
> [!NOTE]
429
-
> Container Apps scale rules only support secret references. Other authentication types such as pod identity are not supported.
479
+
#### Use secrets
430
480
431
481
1. In your container app, create the [secrets](./manage-secrets.md) that you want to reference.
432
482
@@ -436,6 +486,10 @@ A KEDA scaler supports using secrets in a [TriggerAuthentication](https://keda.s
436
486
437
487
1. In the *Authentication* section, select **Add** to create an entry for each KEDA `secretTargetRef` parameter.
438
488
489
+
#### Using managed identity
490
+
491
+
Managed identity authentication is not supported in the Azure portal. Use the [Azure CLI](scale-app.md?pivots=azure-cli#authentication) or [Azure Resource Manager](scale-app.md?&pivots=azure-resource-manager#authentication) to authenticate using managed identity.
0 commit comments