Skip to content

Commit d577619

Browse files
authored
Add environment variable to disable/enable keys (#2280)
* Configure Azure Developer Pipeline * Add parameter for enabling key access * Update CI with new env var
1 parent a0cbcf5 commit d577619

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

.azdo/pipelines/azure-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ steps:
7878
AZURE_OPENAI_GPT4V_DEPLOYMENT_CAPACITY: $(AZURE_OPENAI_GPT4V_DEPLOYMENT_CAPACITY)
7979
AZURE_OPENAI_GPT4V_DEPLOYMENT_VERSION: $(AZURE_OPENAI_GPT4V_DEPLOYMENT_VERSION)
8080
AZURE_OPENAI_GPT4V_DEPLOYMENT_SKU: $(AZURE_OPENAI_GPT4V_DEPLOYMENT_SKU)
81+
AZURE_OPENAI_DISABLE_KEYS: $(AZURE_OPENAI_DISABLE_KEYS)
8182
OPENAI_HOST: $(OPENAI_HOST)
8283
OPENAI_API_KEY: $(OPENAI_API_KEY)
8384
OPENAI_ORGANIZATION: $(OPENAI_ORGANIZATION)

.github/workflows/azure-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
AZURE_OPENAI_GPT4V_DEPLOYMENT_CAPACITY: ${{ vars.AZURE_OPENAI_GPT4V_DEPLOYMENT_CAPACITY }}
6969
AZURE_OPENAI_GPT4V_DEPLOYMENT_VERSION: ${{ vars.AZURE_OPENAI_GPT4V_DEPLOYMENT_VERSION }}
7070
AZURE_OPENAI_GPT4V_DEPLOYMENT_SKU: ${{ vars.AZURE_OPENAI_GPT4V_DEPLOYMENT_SKU }}
71+
AZURE_OPENAI_DISABLE_KEYS: ${{ vars.AZURE_OPENAI_DISABLE_KEYS }}
7172
OPENAI_HOST: ${{ vars.OPENAI_HOST }}
7273
OPENAI_API_KEY: ${{ vars.OPENAI_API_KEY }}
7374
OPENAI_ORGANIZATION: ${{ vars.OPENAI_ORGANIZATION }}

azure.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ pipeline:
7777
- AZURE_OPENAI_GPT4V_DEPLOYMENT_CAPACITY
7878
- AZURE_OPENAI_GPT4V_DEPLOYMENT_VERSION
7979
- AZURE_OPENAI_GPT4V_DEPLOYMENT_SKU
80+
- AZURE_OPENAI_DISABLE_KEYS
8081
- OPENAI_HOST
8182
- OPENAI_API_KEY
8283
- OPENAI_ORGANIZATION

docs/deploy_existing.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ You should set these values before running `azd up`. Once you've set them, retur
2525

2626
1. Run `azd env set AZURE_OPENAI_SERVICE {Name of existing OpenAI service}`
2727
1. Run `azd env set AZURE_OPENAI_RESOURCE_GROUP {Name of existing resource group that OpenAI service is provisioned to}`
28-
1. Run `azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT {Name of existing ChatGPT deployment}`. Only needed if your ChatGPT deployment is not the default 'chat'.
29-
1. Run `azd env set AZURE_OPENAI_EMB_DEPLOYMENT {Name of existing GPT embedding deployment}`. Only needed if your embeddings deployment is not the default 'embedding'.
28+
1. Run `azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT {Name of existing chat deployment}`. Only needed if your chat deployment is not the default 'chat'.
29+
1. Run `azd env set AZURE_OPENAI_CHATGPT_MODEL {Model name of existing chat deployment}`. Only needed if your chat model is not the default 'gpt-35-turbo'.
30+
1. Run `azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION {Version string for existing chat deployment}`. Only needed if your chat deployment model version is not the default '0613'. You definitely need to change this if you changed the model.
31+
1. Run `azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT_SKU {Name of SKU for existing chat deployment}`. Only needed if your chat deployment SKU is not the default 'Standard', like if it is 'GlobalStandard' instead.
32+
1. Run `azd env set AZURE_OPENAI_EMB_DEPLOYMENT {Name of existing embedding deployment}`. Only needed if your embeddings deployment is not the default 'embedding'.
33+
1. Run `azd env set AZURE_OPENAI_EMB_MODEL_NAME {Model name of existing embedding deployment}`. Only needed if your embeddings model is not the default 'text-embedding-ada-002'.
34+
1. Run `azd env set AZURE_OPENAI_EMB_DIMENSIONS {Dimensions for existing embedding deployment}`. Only needed if your embeddings model is not the default 'text-embedding-ada-002'.
35+
1. Run `azd env set AZURE_OPENAI_EMB_DEPLOYMENT_VERSION {Version string for existing embedding deployment}`. If your embeddings deployment is one of the 'text-embedding-3' models, set this to the number 1.
36+
1. This project does *not* use keys when authenticating to Azure OpenAI. However, if your Azure OpenAI service must have key access enabled for some reason (like for use by other projects), then run `azd env set AZURE_OPENAI_DISABLE_KEYS false`. The default value is `true` so you should only run the command if you need key access.
3037

3138
When you run `azd up` after and are prompted to select a value for `openAiResourceGroupLocation`, make sure to select the same location as the existing OpenAI resource group.
3239

infra/main.bicep

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ param azureOpenAiCustomUrl string = ''
5252
param azureOpenAiApiVersion string = ''
5353
@secure()
5454
param azureOpenAiApiKey string = ''
55+
param azureOpenAiDisableKeys bool = true
5556
param openAiServiceName string = ''
5657
param openAiResourceGroupName string = ''
5758

@@ -598,7 +599,7 @@ module openAi 'br/public:avm/res/cognitive-services/account:0.7.2' = if (isAzure
598599
}
599600
sku: openAiSkuName
600601
deployments: openAiDeployments
601-
disableLocalAuth: true
602+
disableLocalAuth: azureOpenAiDisableKeys
602603
}
603604
}
604605

infra/main.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@
155155
"azureOpenAiApiKey":{
156156
"value": "${AZURE_OPENAI_API_KEY_OVERRIDE}"
157157
},
158+
"azureOpenAiDisableKeys": {
159+
"value": "${AZURE_OPENAI_DISABLE_KEYS=true}"
160+
},
158161
"openAiApiKey": {
159162
"value": "${OPENAI_API_KEY}"
160163
},

0 commit comments

Comments
 (0)