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
This tutorial shows you how to connect your Azure Kubernetes Service (AKS) applications to Azure OpenAI using Service Connector with workload identity authentication. You'll establish credential-free connections by deploying a sample Python application that communicates with the Azure OpenAI.
19
+
This tutorial shows you how to connect your Azure Kubernetes Service (AKS) applications to Azure OpenAI using Service Connector with workload identity authentication. You then establish and test your credential-free connections by deploying a sample Python application that communicates with the Azure OpenAI.
20
20
21
-
You'll complete the following tasks:
21
+
In this tutorial, you:
22
22
23
23
> [!div class="checklist"]
24
24
>
@@ -60,15 +60,15 @@ You start this tutorial by creating several Azure resources.
60
60
--generate-ssh-keys
61
61
```
62
62
63
-
1. Connect to the cluster using the [az aks get-credentials](/cli/azure/aks#az-aks-get-credentials) command.
63
+
1. Connect to the cluster using the [`az aks get-credentials`](/cli/azure/aks#az-aks-get-credentials) command.
64
64
65
65
```azurecli
66
66
az aks get-credentials \
67
67
--resource-group MyResourceGroup \
68
68
--name MyAKSCluster
69
69
```
70
70
71
-
1. Create an Azure OpenAI resource using the [az cognitiveservices account create](/cli/azure/cognitiveservices/account#az-cognitiveservices-account-create) command. Optionally refer to [this tutorial](/azure/ai-services/openai/how-to/create-resource) for more instructions. Azure OpenAI is the target service that the AKS cluster connects to.
71
+
1. Create an Azure OpenAI resource using the [`az cognitiveservices account create`](/cli/azure/cognitiveservices/account#az-cognitiveservices-account-create) command. Optionally refer to [this tutorial](/azure/ai-services/openai/how-to/create-resource) for more instructions. Azure OpenAI is the target service that the AKS cluster connects to.
72
72
73
73
```azurecli
74
74
az cognitiveservices account create \
@@ -81,7 +81,7 @@ You start this tutorial by creating several Azure resources.
81
81
--subscription <SubscriptionID>
82
82
```
83
83
84
-
1. Deploy a model with the [az cognitiveservices deployment create](/cli/azure/cognitiveservices/account/deployment#az-cognitiveservices-account-deployment-create) command. The model is used in the sample application to test the connection.
84
+
1. Deploy a model with the [`az cognitiveservices deployment create`](/cli/azure/cognitiveservices/account/deployment#az-cognitiveservices-account-deployment-create) command. The model is used in the sample application to test the connection.
85
85
86
86
```azurecli-interactive
87
87
az cognitiveservices account deployment create \
@@ -95,7 +95,7 @@ You start this tutorial by creating several Azure resources.
95
95
--capacity 1
96
96
```
97
97
98
-
1. Create an Azure Container Registry (ACR) to store the containerized sample application. Use the [az acr create](/cli/azure/acr#az-acr-create) command, or refer to [this tutorial](/azure/container-registry/container-registry-get-started-portal).
98
+
1. To store the containerized sample application, create an Azure Container Registry (ACR). Use the [`az acr create`](/cli/azure/acr#az-acr-create) command, or refer to [this tutorial](/azure/container-registry/container-registry-get-started-portal).
99
99
100
100
```azurecli-interactive
101
101
az acr create \
@@ -104,7 +104,7 @@ You start this tutorial by creating several Azure resources.
104
104
--sku Standard
105
105
```
106
106
107
-
1. Enable anonymous pull using the [az acr update](/cli/azure/acr#az-acr-update) command so that the AKS cluster can consume the images in the registry.
107
+
1. Enable anonymous pull using the [`az acr update`](/cli/azure/acr#az-acr-update) command so that the AKS cluster can consume the images in the registry.
108
108
109
109
```azurecli-interactive
110
110
az acr update \
@@ -113,7 +113,7 @@ You start this tutorial by creating several Azure resources.
113
113
--anonymous-pull-enabled
114
114
```
115
115
116
-
1. Create a user-assigned managed identity with the [az identity create](/cli/azure/identity#az-identity-create) command, or by referring to [this tutorial](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities). When the connection is created, the user-assigned managed identity is used to enable the [workload identity](/entra/workload-id/workload-identities-overview) for AKS workloads.
116
+
1. Create a user-assigned managed identity with the [`az identity create`](/cli/azure/identity#az-identity-create) command, or by referring to [this tutorial](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities). When the connection is created, the user-assigned managed identity is used to enable the [workload identity](/entra/workload-id/workload-identities-overview) for AKS workloads.
117
117
118
118
```azurecli
119
119
az identity create \
@@ -146,20 +146,20 @@ Refer to the [AKS service connection quickstart](quickstart-portal-aks-connectio
| **Authentication type** | *Workload Identity* | The authentication method to connect the app to Azure OpenAI. Workload identity is recommended for enhanced security. Alternative methods include connection string and service principal, and require credential management considerations. |
148
148
| **Subscription** | *My Subscription* | The subscription that contains the user-assigned managed identity. |
149
-
| **User assigned managed identity** | *myidentity* | The user-assigned managed identity that enables workload identity authentication for the AKS cluster. |
149
+
| **User assigned managed identity** | *MyIdentity* | The user-assigned managed identity that enables workload identity authentication for the AKS cluster. |
150
150
151
151
Once the connection is created, you can view its details in the **Service Connector** pane.
152
152
153
153
### [Azure CLI](#tab/azure-cli)
154
154
155
-
Create a service connection from AKS to the Azure OpenAI resource by running the [az aks connection create cognitiveservices](/cli/azure/aks/connection/create#az-aks-connection-create-cognitiveservices) command in the Azure CLI.
155
+
Create a service connection from AKS to the Azure OpenAI resource by running the [`az aks connection create cognitiveservices`](/cli/azure/aks/connection/create#az-aks-connection-create-cognitiveservices) command in the Azure CLI.
156
156
157
157
```azurecli
158
158
az aks connection create cognitiveservices \
159
159
--workload-identity <user-identity-resource-id>
160
160
```
161
161
162
-
When you use the preceding command, Service Connector prompts you step by step to specify the AKS resource group, AKS cluster name, target service resource group, cognitive service account name, and user-assigned identity resource ID.
162
+
When you use the preceding command, Service Connector prompts you step by step to specify: the AKS resource group, AKS cluster name, target service resource group, cognitive service account name, and user-assigned identity resource ID.
163
163
164
164
Alternatively, you can provide the complete command directly:
165
165
@@ -195,13 +195,13 @@ az aks connection create cognitiveservices \
195
195
196
196
## Build and push container images to Azure Container Registry
197
197
198
-
1. Build and push the images to your container registry using the Azure CLI [az acr build](/cli/azure/acr#az_acr_build) command.
198
+
1. Build and push the images to your container registry using the Azure CLI [`az acr build`](/cli/azure/acr#az_acr_build) command.
199
199
200
200
```azurecli-interactive
201
201
az acr build --registry myregistry --image sc-demo-openai-identity:latest ./
202
202
```
203
203
204
-
1. View the images in your container registry using the [az acr repository list](/cli/azure/acr/repository#az_acr_repository_list) command.
204
+
1. View the images in your container registry using the [`az acr repository list`](/cli/azure/acr/repository#az_acr_repository_list) command.
205
205
206
206
```azurecli-interactive
207
207
az acr repository list --name myregistry --output table
@@ -215,7 +215,7 @@ az aks connection create cognitiveservices \
215
215
* Replace `<ServiceAccountCreatedByServiceConnector>` with the service account name. It can be found in the Azure portal, in the **Service Connector** pane.
216
216
* Replace `<SecretCreatedByServiceConnector>` with the secret name. It can be found in the Azure portal, in the **Service Connector** pane.
217
217
218
-
1. Deploy the pod to your cluster with the `kubectl apply` command, which creates a pod named `sc-demo-openai-identity` in the default namespace of your AKS cluster. Install `kubectl` locally using the [az aks install-cli](/cli/azure/aks#az_aks_install_cli) command if it isn't installed.
218
+
1. Deploy the pod to your cluster with the `kubectl apply` command, which creates a pod named `sc-demo-openai-identity` in the default namespace of your AKS cluster. Install `kubectl` locally using the [`az aks install-cli`](/cli/azure/aks#az_aks_install_cli) command if it isn't installed.
0 commit comments