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: bridge/articles/bridge-to-kubernetes-vs-code.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ Select **Run** then **Stop Debugging** or press **Shift**+**F5** to stop the deb
113
113
114
114
Bridge to Kubernetes can handle routing traffic and replicating environment variables without any additional configuration. If you need to download any files that are mounted to the container in your Kubernetes cluster, such as a ConfigMap file, you can create a `KubernetesLocalProcessConfig.yaml` to download those files to your development computer. For more information, see [Configure Bridge to Kubernetes][kubernetesLocalProcessConfig-yaml].
115
115
116
-
If you're using an AKS cluster that uses managed identity, a security feature provided by Azure Active Directory, see [Use managed identity with Bridge to Kubernetes](managed-identity.md) for information about how to configure Bridge to Kubernetes for this scenario.
116
+
If you're using an AKS cluster that uses managed identity, a security feature provided by Microsoft Entra ID, see [Use managed identity with Bridge to Kubernetes](managed-identity.md) for information about how to configure Bridge to Kubernetes for this scenario.
Copy file name to clipboardExpand all lines: bridge/articles/managed-identity.md
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,14 @@ title: "How to use managed identity with Bridge to Kubernetes"
3
3
ms.technology: bridge
4
4
ms.date: 08/11/2022
5
5
ms.topic: "conceptual"
6
-
description: "Learn how to use Azure Active Directory (Azure AD) managed identity in an AKS cluster with Bridge to Kubernetes"
6
+
description: "Learn how to use Microsoft Entra managed identity in an AKS cluster with Bridge to Kubernetes"
7
7
manager: jmartens
8
8
author: ghogen
9
9
ms.author: ghogen
10
10
---
11
11
# Use managed identity with Bridge to Kubernetes
12
12
13
-
If your AKS cluster uses [managed identity](/azure/active-directory/managed-identities-azure-resources/overview) security features to secure access to secrets and resources, Bridge to Kubernetes needs some special configuration to ensure it can work with these features. An Azure Active Directory (AD) token needs to be downloaded to the local machine to ensure that local execution and debugging is properly secured, and this requires some special configuration in Bridge to Kubernetes. This article shows how to configure Bridge to Kubernetes to work with services that use managed identity.
13
+
If your AKS cluster uses [managed identity](/azure/active-directory/managed-identities-azure-resources/overview) security features to secure access to secrets and resources, Bridge to Kubernetes needs some special configuration to ensure it can work with these features. A Microsoft Entra token needs to be downloaded to the local machine to ensure that local execution and debugging is properly secured, and this requires some special configuration in Bridge to Kubernetes. This article shows how to configure Bridge to Kubernetes to work with services that use managed identity.
14
14
15
15
## How to configure your service to use managed identity
16
16
@@ -22,11 +22,13 @@ enableFeatures:
22
22
```
23
23
24
24
> [!WARNING]
25
-
> Be sure to only use managed identity for Bridge to Kubernetes when working with dev clusters, not production clusters, because the Azure AD token is fetched to the local machine, which presents a potential security risk.
25
+
> Be sure to only use managed identity for Bridge to Kubernetes when working with dev clusters, not production clusters, because the Microsoft Entra token is fetched to the local machine, which presents a potential security risk.
26
26
27
27
If you don't have a *KubernetesLocalConfig.yaml* file, you can create one; see [How to: Configure Bridge to Kubernetes](configure-bridge-to-kubernetes.md).
You must ensure that you are relying on either `Azure.Identity.DefaultAzureCredential` or `Azure.Identity.ManagedIdentityCredential` in code when fetching the token.
32
34
@@ -52,7 +54,7 @@ To learn how to access other Azure resources using managed identity, see the [Ne
52
54
53
55
## Receive Azure alerts when tokens are downloaded
54
56
55
-
Whenever you use Bridge to Kubernetes on a service, the Azure AD token is downloaded to the local machine. You can enable Azure alerts to be notified when this occurs. For information, see [Enable Azure Defender](/azure/security-center/enable-azure-defender). Please be aware that there is a charge (after a 30-day trial period).
57
+
Whenever you use Bridge to Kubernetes on a service, the Microsoft Entra token is downloaded to the local machine. You can enable Azure alerts to be notified when this occurs. For information, see [Enable Azure Defender](/azure/security-center/enable-azure-defender). Please be aware that there is a charge (after a 30-day trial period).
56
58
57
59
## Next steps
58
60
@@ -68,4 +70,4 @@ There are other tutorials in that section as well for using managed identity to
68
70
69
71
## See also
70
72
71
-
[Azure Active Directory](/azure/active-directory/managed-identities-azure-resources/)
Copy file name to clipboardExpand all lines: docs/containers/edit-and-refresh.md
+38-2Lines changed: 38 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ ms.author: ghogen
5
5
author: ghogen
6
6
manager: jmartens
7
7
ms.topic: how-to
8
-
ms.date: 10/17/2023
8
+
ms.date: 11/08/2023
9
9
ms.technology: vs-container-tools
10
10
---
11
11
# Debug apps in a local Docker container
@@ -157,12 +157,48 @@ The following procedure demonstrates how to add orchestration support to a .NET
157
157

158
158
::: moniker-end
159
159
160
+
:::moniker range=">=vs-2022"
161
+
## Authenticating to Azure services using the token proxy
162
+
163
+
When you're using Azure services from a container, you can use [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) (withthe [VisualStudioCredential](/dotnet/api/azure.identity.visualstudiocredential) enabled) to authenticate with Azure services with your Microsoft Entra account without any additional configuration in the container. To enable this, see [How to configure Visual Studio Container Tools](container-tools-configure.md). Also, you need to set up Azure authentication in Visual Studio by following the instructions at [Authenticate Visual Studio with Azure](/dotnet/azure/configure-visual-studio#authenticate-visual-studio-with-azure). The support for VisualStudioCredential in a container is available in Visual Studio version 17.6 and later.
164
+
165
+
### Azure Functions
166
+
167
+
If you're debugging an integrated Azure Functions project and using the token proxy in the container to handle authentication to Azure services, you need to copy the .NET runtime onto the container for the token proxy to run. If you're debugging an isolated Azure Functions project, it already has the .NET runtime, so there's no need for this extra step.
168
+
169
+
To ensure the .NET runtime is available to the token proxy, add or modify the `debug` layer in the Dockerfile that copies the .NET runtime into the container image. For Linux containers, you can add the following code to the Dockerfile:
170
+
171
+
```dockerfile
172
+
# This layer is to support debugging, VS's Token Proxy requires the runtime to be installed in the container
173
+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
177
+
```
178
+
179
+
Also, in the Visual Studio project, you need to make some changes to specify this as the layer to use when debugging in Fast Mode. For an explanation of Fast Mode, see [Customize Docker containers in Visual Studio](container-build.md#debugging). For single container scenarios (notDockerCompose), set the MSBuild property `DockerfileFastModeStage` to `debug` in order to use that layer for debugging. For Docker Compose, modify the `docker-compose.vs.debug.yml` as follows:
180
+
181
+
```yml
182
+
# Set the stage to debug to use an image with the .NET runtime in it
183
+
services:
184
+
functionappintegrated:
185
+
build:
186
+
target: debug
187
+
```
188
+
189
+
For a code sample of authentication with Azure Functions, including both integrated and isolated scenarios, see [VisualStudioCredentialExample](https://github.com/NCarlsonMSFT/VisualStudioCredentialExample).
190
+
:::moniker-end
191
+
160
192
## Container reuse
161
193
162
-
During the development cycle, Visual Studio rebuilds only your container images and the container itself when you change the Dockerfile. If you don't change the Dockerfile, Visual Studio reuses the container from an earlier run.
194
+
Whenyouuse [FastMode](container-build.md#debugging), whichVisualStudionormallyusesfortheDebugconfiguration, VisualStudiorebuildsonlyyourcontainerimagesandthecontaineritselfwhenyouchangetheDockerfile. Ifyoudon't change the Dockerfile, Visual Studio reuses the container from an earlier run.
0 commit comments