Skip to content

Commit 903f00d

Browse files
authored
Merge pull request #288004 from MicrosoftDocs/main
Publish to live, Tuesday 4 AM PST, 10/8
2 parents dffce24 + 20f5541 commit 903f00d

File tree

635 files changed

+1178
-758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

635 files changed

+1178
-758
lines changed

articles/active-directory-b2c/identity-verification-proofing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about our partners who integrate with Azure AD B2C to provide
55
author: gargi-sinha
66
manager: martinco
77
ms.reviewer: kengaderdus
8-
ms.service: active-directory
8+
ms.service: azure-active-directory
99
ms.topic: how-to
1010
ms.date: 01/26/2024
1111
ms.author: gasinh
Lines changed: 112 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
---
22
title: 'Tutorial: Get started connecting an AKS application to a cache'
33
description: In this tutorial, you learn how to connect your AKS-hosted application to an Azure Cache for Redis instance.
4-
5-
6-
7-
84
ms.topic: tutorial
9-
ms.date: 08/15/2023
5+
ms.date: 10/01/2024
106
#CustomerIntent: As a developer, I want to see how to use a Azure Cache for Redis instance with an AKS container so that I see how I can use my cache instance with a Kubernetes cluster.
117

128
---
@@ -19,6 +15,7 @@ In this tutorial, you adapt the [AKS sample voting application](https://github.c
1915

2016
- An Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2117
- An Azure Kubernetes Service Cluster - For more information on creating a cluster, see [Quickstart: Deploy an Azure Kubernetes Service (AKS) cluster using the Azure portal](/azure/aks/learn/quick-kubernetes-deploy-portal).
18+
- A user assigned managed identity that you want to use to connect to your Azure Cache for Redis instance.
2219

2320
> [!IMPORTANT]
2421
> This tutorial assumes that you are familiar with basic Kubernetes concepts like containers, pods and service.
@@ -30,17 +27,46 @@ In this tutorial, you adapt the [AKS sample voting application](https://github.c
3027
For this tutorial, use a Standard C1 cache.
3128
:::image type="content" source="media/cache-tutorial-aks-get-started/cache-new-instance.png" alt-text="Screenshot of creating a Standard C1 cache in the Azure portal":::
3229

33-
1. On the **Advanced** tab, enable **Non-TLS port**.
34-
:::image type="content" source="media/cache-tutorial-aks-get-started/cache-non-tls.png" alt-text="Screenshot of the Advanced tab with Non-TLS enabled during cache creation.":::
35-
3630
1. Follow the steps through to create the cache.
3731

38-
> [!IMPORTANT]
39-
> This tutorial uses a non-TLS port for demonstration, but we highly recommend that you use a TLS port for anything in production.
32+
1. Once your Redis cache instance is created, navigate to the **Authentication** tab. Select the user assigned managed identity you want to use to connect to your Redis cache instance, then select **Save**.
33+
34+
1. Alternatively, you can navigate to Data Access Configuration on the Resource menu to create a new Redis user with your user assigned managed identity to connect to your cache.
35+
36+
1. Take note of the user name for your Redis user from the portal. You use this user name with the AKS workload.
37+
38+
## Run sample locally
39+
40+
To run this sample locally, configure your user principal as a Redis User on your Redis instance. The code sample will use your user principal through (DefaultAzureCredential)[https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication/?tabs=command-line#use-defaultazurecredential-in-an-application] to connect to Redis instance.
41+
42+
## Configure your AKS cluster
4043

41-
Creating the cache can take a few minutes. You can move to the next section while the process finishes.
44+
Follow these [steps](/azure/aks/workload-identity-deploy-cluster) to configure a workload identity for your AKS cluster. Complete the following steps:
4245

43-
## Install and connect to your AKS cluster
46+
- Enable OIDC issuer and workload identity
47+
- Skip the step to create user assigned managed identity if you already created your managed identity. If you create a new managed identity, ensure that you create a new Redis User for your managed identity and assign appropriate data access permissions.
48+
- Create a Kubernetes Service account annotated with the client ID of your user assigned managed identity
49+
- Create a federated identity credential for your AKS cluster.
50+
51+
## Configure your workload that connects to Azure Cache for Redis
52+
53+
Next, set up the AKS workload to connect to Azure Cache for Redis after you configure the AKS cluster.
54+
55+
1. Download the code for the [sample app](https://github.com/Azure-Samples/azure-cache-redis-sample/connect-from-aks).
56+
57+
1. Build and push docker image to your Azure Container Registry using [az acr build](/cli/azure/acr#az-acr-build) command.
58+
59+
```bash
60+
az acr build --image sample/connect-from-aks-sample:1.0 --registry yourcontainerregistry --file Dockerfile .
61+
```
62+
63+
1. Attach your container registry to your AKS cluster using following command:
64+
65+
```bash
66+
az aks update --name clustername --resource-group mygroup --attach-acr youracrname
67+
```
68+
69+
## Deploy your workload
4470

4571
In this section, you first install the Kubernetes CLI and then connect to an AKS cluster.
4672

@@ -56,148 +82,116 @@ If you use Azure Cloud Shell, _kubectl_ is already installed, and you can skip t
5682
5783
### Connect to your AKS cluster
5884
59-
Use the portal to copy the resource group and cluster name for your AKS cluster. To configure _kubectl_ to connect to your AKS cluster, use the following command with your resource group and cluster name:
60-
61-
```bash
62-
az aks get-credentials --resource-group myResourceGroup --name myClusterName
63-
```
64-
65-
Verify that you're able to connect to your cluster by running the following command:
85+
1. Use the portal to copy the resource group and cluster name for your AKS cluster. To configure _kubectl_ to connect to your AKS cluster, use the following command with your resource group and cluster name:
6686
67-
```bash
68-
kubectl get nodes
69-
```
70-
71-
You should see similar output showing the list of your cluster nodes.
72-
73-
```output
74-
NAME STATUS ROLES AGE VERSION
75-
aks-agentpool-21274953-vmss000001 Ready agent 1d v1.24.15
76-
aks-agentpool-21274953-vmss000003 Ready agent 1d v1.24.15
77-
aks-agentpool-21274953-vmss000006 Ready agent 1d v1.24.15
78-
```
79-
80-
## Update the voting application to use Azure Cache for Redis
87+
```bash
88+
az aks get-credentials --resource-group myResourceGroup --name myClusterName
89+
```
8190
82-
Use the [.yml file](https://github.com/Azure-Samples/azure-voting-app-redis/blob/master/azure-vote-all-in-one-redis.yaml) in the sample for reference.
91+
1. Verify that you're able to connect to your cluster by running the following command:
8392

84-
Make the following changes to the deployment file before you save the file as _azure-vote-sample.yaml_.
93+
```bash
94+
kubectl get nodes
95+
```
8596

86-
1. Remove the deployment and service named `azure-vote-back`. This deployment is used to deploy a Redis container to your cluster that is not required when using Azure Cache for Redis.
97+
You should see similar output showing the list of your cluster nodes.
8798

88-
2. Replace the value `REDIS` variable from "azure-vote-back" to the _hostname_ of the Azure Cache for Redis instance that you created earlier. This change indicates that your application should use Azure Cache for Redis instead of a Redis container.
99+
```bash
100+
NAME STATUS ROLES AGE VERSION
101+
aks-agentpool-21274953-vmss000001 Ready agent 1d v1.29.7
102+
aks-agentpool-21274953-vmss000003 Ready agent 1d v1.29.7
103+
aks-agentpool-21274953-vmss000006 Ready agent 1d v1.29.7
104+
```
89105

90-
3. Define variable named `REDIS_PWD`, and set the value to the _access key_ for the Azure Cache for Redis instance that you created earlier.
106+
## Run your workload
91107

92-
After all the changes, the deployment file should look like following file with your _hostname_ and _access key_. Save your file as _azure-vote-sample.yaml_.
108+
1. The following code describes the pod specification file that you use to run our workload. Take note that the pod has the label _azure.workloadidentity/use: "true"_ and is annotated with _serviceAccountName_ as required by AKS workload identity. When using access key authentication, replace the value of AUTHENTICATION_TYPE, REDIS_HOSTNAME and REDIS_ACCESSKEY environment variables.
93109

94-
```YAML
95-
apiVersion: apps/v1
96-
kind: Deployment
97-
metadata:
98-
name: azure-vote-front
99-
spec:
100-
replicas: 1
101-
selector:
102-
matchLabels:
103-
app: azure-vote-front
104-
strategy:
105-
rollingUpdate:
106-
maxSurge: 1
107-
maxUnavailable: 1
108-
minReadySeconds: 5
109-
template:
110+
```yml
111+
apiVersion: v1
112+
kind: Pod
110113
metadata:
114+
name: entrademo-pod
111115
labels:
112-
app: azure-vote-front
116+
azure.workload.identity/use: "true" # Required. Only pods with this label can use workload identity.
113117
spec:
114-
nodeSelector:
115-
"kubernetes.io/os": linux
118+
serviceAccountName: workload-identity-sa
116119
containers:
117-
- name: azure-vote-front
118-
image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
119-
ports:
120-
- containerPort: 80
120+
- name: entrademo-container
121+
image: youracr.azurecr.io/connect-from-aks-sample:1.0
122+
imagePullPolicy: Always
123+
command: ["dotnet", "ConnectFromAKS.dll"]
121124
resources:
122-
requests:
123-
cpu: 250m
124125
limits:
125-
cpu: 500m
126+
memory: "256Mi"
127+
cpu: "500m"
128+
requests:
129+
memory: "128Mi"
130+
cpu: "250m"
126131
env:
127-
- name: REDIS
128-
value: myrediscache.redis.cache.windows.net
129-
- name: REDIS_PWD
130-
value: myrediscacheaccesskey
131-
---
132-
apiVersion: v1
133-
kind: Service
134-
metadata:
135-
name: azure-vote-front
136-
spec:
137-
type: LoadBalancer
138-
ports:
139-
- port: 80
140-
selector:
141-
app: azure-vote-front
142-
```
143-
144-
## Deploy and test your application
132+
- name: AUTHENTICATION_TYPE
133+
value: "MANAGED_IDENTITY" # change to ACCESS_KEY to authenticate using access key
134+
- name: REDIS_HOSTNAME
135+
value: "your redis hostname"
136+
- name: REDIS_ACCESSKEY
137+
value: "your access key"
138+
- name: REDIS_PORT
139+
value: "6380"
140+
restartPolicy: Never
141+
142+
```
145143

146-
Run the following command to deploy this application to your AKS cluster:
144+
1. Save this file as podspec.yaml and then apply it to your AKS cluster by running the folloWing command:
147145

148-
```bash
149-
kubectl apply -f azure-vote-sample.yaml
150-
```
146+
```bash
147+
kubectl apply -f podspec.yaml
148+
```
151149

152-
You get a response indicating your deployment and service was created:
150+
You get a response indicating your pod was created:
153151

154-
```output
155-
deployment.apps/azure-vote-front created
156-
service/azure-vote-front created
157-
```
152+
```bash
153+
pod/entrademo-pod created
154+
```
158155

159-
To test the application, run the following command to check if the pod is running:
156+
1. To test the application, run the following command to check if the pod is running:
160157

161-
```bash
162-
kubectl get pods
163-
```
158+
```bash
159+
kubectl get pods
160+
```
164161

165-
You see your pod running successfully like:
162+
You see your pod running successfully like:
166163

167-
```output
168-
NAME READY STATUS RESTARTS AGE
169-
azure-vote-front-7dd44597dd-p4cnq 1/1 Running 0 68s
170-
```
164+
```bash
165+
NAME READY STATUS RESTARTS AGE
166+
entrademo-pod 0/1 Completed 0 42s
167+
```
171168

172-
Run the following command to get the endpoint for your application:
169+
1. Because this tutorial is a console app, you need to check the logs of the pod to verify that it ran as expected using this command.
173170

174-
```bash
175-
kubectl get service azure-vote-front
176-
```
177-
178-
You might see that the EXTERNAL-IP has status `<pending>` for a few minutes. Keep retrying until the status is replaced by an IP address.
179-
180-
```output
181-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
182-
azure-vote-front LoadBalancer 10.0.166.147 20.69.136.105 80:30390/TCP 90s
183-
```
171+
```bash
172+
kubectl logs entrademo-app
173+
```
184174

185-
Once the External-IP is available, open a web browser to the External-IP address of your service and you see the application running as follows:
175+
You see the following logs that indicate your pod successfully connected to your Redis instance using user assigned managed identity
186176

187-
:::image type="content" source="media/cache-tutorial-aks-get-started/cache-web-voting-app.png" alt-text="Screenshot of the voting application running in a browser with buttons for cats, dogs, and reset.":::
177+
```bash
178+
Connecting with managed identity..
179+
Retrieved value from Redis: Hello, Redis!
180+
Success! Previous value: Hello, Redis!
181+
```
188182

189-
## Clean up your deployment
183+
## Clean up your cluster
190184

191185
To clean up your cluster, run the following commands:
192186

193187
```bash
194-
kubectl delete deployment azure-vote-front
195-
kubectl delete service azure-vote-front
188+
kubectl delete pod entrademo-pod
196189
```
197190

198191
[!INCLUDE [cache-delete-resource-group](includes/cache-delete-resource-group.md)]
199192

200193
## Related content
201194

202195
- [Quickstart: Deploy an Azure Kubernetes Service (AKS) cluster using the Azure portal](/azure/aks/learn/quick-kubernetes-deploy-portal)
203-
- [AKS sample voting application](https://github.com/Azure-Samples/azure-voting-app-redis/tree/master)
196+
- [Quickstart: Deploy and configure workload identity on an Azure Kubernetes Service (AKS) cluster](/azure/aks/workload-identity-deploy-cluster)
197+
- [Azure Cache for Redis Entra ID Authentication](/azure/azure-cache-for-redis/cache-azure-active-directory-for-authentication)

articles/governance/policy/samples/australia-ism.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Regulatory Compliance details for Australian Government ISM PROTECTED
33
description: Details of the Australian Government ISM PROTECTED Regulatory Compliance built-in initiative. Each control is mapped to one or more Azure Policy definitions that assist with assessment.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/azure-security-benchmark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Regulatory Compliance details for Microsoft cloud security benchmark
33
description: Details of the Microsoft cloud security benchmark Regulatory Compliance built-in initiative. Each control is mapped to one or more Azure Policy definitions that assist with assessment.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/built-in-initiatives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: List of built-in policy initiatives
33
description: List built-in policy initiatives for Azure Policy. Categories include Regulatory Compliance, Azure Machine Configuration, and more.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/built-in-policies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: List of built-in policy definitions
33
description: List built-in policy definitions for Azure Policy. Categories include Tags, Regulatory Compliance, Key Vault, Kubernetes, Azure Machine Configuration, and more.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/canada-federal-pbmm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Regulatory Compliance details for Canada Federal PBMM
33
description: Details of the Canada Federal PBMM Regulatory Compliance built-in initiative. Each control is mapped to one or more Azure Policy definitions that assist with assessment.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/cis-azure-1-1-0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Regulatory Compliance details for CIS Microsoft Azure Foundations Benchmark 1.1.0
33
description: Details of the CIS Microsoft Azure Foundations Benchmark 1.1.0 Regulatory Compliance built-in initiative. Each control is mapped to one or more Azure Policy definitions that assist with assessment.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/cis-azure-1-3-0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Regulatory Compliance details for CIS Microsoft Azure Foundations Benchmark 1.3.0
33
description: Details of the CIS Microsoft Azure Foundations Benchmark 1.3.0 Regulatory Compliance built-in initiative. Each control is mapped to one or more Azure Policy definitions that assist with assessment.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

articles/governance/policy/samples/cis-azure-1-4-0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Regulatory Compliance details for CIS Microsoft Azure Foundations Benchmark 1.4.0
33
description: Details of the CIS Microsoft Azure Foundations Benchmark 1.4.0 Regulatory Compliance built-in initiative. Each control is mapped to one or more Azure Policy definitions that assist with assessment.
4-
ms.date: 09/30/2024
4+
ms.date: 10/08/2024
55
ms.topic: sample
66
ms.custom: generated
77
---

0 commit comments

Comments
 (0)