forked from microsoft/ai-sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding in support for JWT tokens to openai backends
- Loading branch information
Showing
5 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# AKS Workload Identity setup | ||
|
||
## MI creation | ||
```powershell | ||
az account set --subscription "subscriptionID" | ||
``` | ||
|
||
```powershell | ||
az identity create --name "ai-sentry-be-mi" --resource-group "ai-sentry" --location "australiaeast" --subscription "879bb272-07db-4784-816a-a9fac90f49ae" | ||
``` | ||
|
||
```bash | ||
export USER_ASSIGNED_CLIENT_ID="$(az identity show --resource-group "ai-sentry" --name "ai-sentry-be-mi" --query 'clientId' -otsv)" | ||
``` | ||
## Grant MI access to openAI resources | ||
|
||
![alt text](..\images\openai_rbac.png) | ||
|
||
and assign your newly built managed identity to above role: | ||
|
||
![alt text](..\images\openai_rbac2.png) | ||
|
||
|
||
## Env variables for service account in AKS | ||
|
||
```bash | ||
export SERVICE_ACCOUNT_NAME="default" | ||
export SERVICE_ACCOUNT_NAMESPACE="ai-sentry" | ||
``` | ||
|
||
## OIDC Issuer url | ||
|
||
```bash | ||
export AKS_OIDC_ISSUER="$(az aks show --name anevjes-aks --resource-group aks --query "oidcIssuerProfile.issuerUrl" -o tsv)" | ||
``` | ||
|
||
## Create AKS Service Account | ||
|
||
```bash | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
annotations: | ||
azure.workload.identity/client-id: ${USER_ASSIGNED_CLIENT_ID} | ||
name: ${SERVICE_ACCOUNT_NAME} | ||
namespace: ${SERVICE_ACCOUNT_NAMESPACE} | ||
EOF | ||
``` | ||
## Establish federated identity credential trust | ||
|
||
```powershell | ||
az identity federated-credential create --name ai-sentry-be-fed --identity-name ai-sentry-be-mi --resource-group ai-sentry --issuer ${AKS_OIDC_ISSUER} --subject system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME} --audience api://AzureADTokenExchange | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters