Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add AOAI resource group to use existing AOAI service #132

Open
cynthiajiangatl opened this issue Aug 9, 2024 · 4 comments
Open

Comments

@cynthiajiangatl
Copy link

cynthiajiangatl commented Aug 9, 2024

Need to add resource group for AOAI service to avoid deployment errors.

For existing Azure OpenAI service, it may not be in the newly created resource group, needs to add AOAI_RESOURCE_GROUP in deploy.parameters.json and update the deploy.sh in a couple of places.

requiredParams=(
LOCATION
GRAPHRAG_API_BASE
GRAPHRAG_API_VERSION
GRAPHRAG_LLM_MODEL
GRAPHRAG_LLM_DEPLOYMENT_NAME
GRAPHRAG_EMBEDDING_MODEL
GRAPHRAG_EMBEDDING_DEPLOYMENT_NAME
RESOURCE_GROUP
AOAI_RESOURCE_GROUP
)

deployAzureResources () {
echo "Deploying Azure resources..."
local SSH_PUBLICKEY=$(jq -r .publicKey <<< $SSHKEY_DETAILS)
exitIfValueEmpty "$SSH_PUBLICKEY" "Unable to read ssh publickey, exiting..."
local aoaiName=$(az cognitiveservices account list -g $AOAI_RESOURCE_GROUP --query "[?contains(properties.endpoint, '$GRAPHRAG_API_BASE')] | [0].name" -o tsv)
exitIfValueEmpty "$aoaiName" "Unable to retrieve AOAI name from GRAPHRAG_API_BASE, exiting..."

assignAOAIRoleToManagedIdentity() {
printf "Assigning 'Cognitive Services OpenAI Contributor' role to managed identity... "
local servicePrincipalId=$(jq -r .azure_workload_identity_principal_id.value <<< $AZURE_OUTPUTS)
exitIfValueEmpty "$servicePrincipalId" "Unable to parse service principal id from azure outputs, exiting..."
local scope=$(az cognitiveservices account list -g $AOAI_RESOURCE_GROUP --query "[?contains(properties.endpoint, '$GRAPHRAG_API_BASE')] | [0].id" -o tsv)
az role assignment create --only-show-errors
--role "Cognitive Services OpenAI Contributor"
--assignee "$servicePrincipalId"
--scope "$scope" > /dev/null 2>&1
exitIfCommandFailed $? "Error assigning role to service principal, exiting..."
printf "Done.\n"
}

@cynthiajiangatl cynthiajiangatl changed the title [FEATURE] Need to add AOAI resource group to use existing AOAI service [FEATURE] Add AOAI resource group to use existing AOAI service Aug 9, 2024
@timothymeyers
Copy link
Contributor

Hi @cynthiajiangatl - I've never run into any deployment errors when deploying with my AOAI resource in a different RG.

The az cognitiveservices account list command should return all AOAI resources that match the endpoint provided, regardless of RG.

I'm not sure this is needed?

@rnpramasamyai
Copy link

@cynthiajiangatl
Are you using Linux?

@cynthiajiangatl
Copy link
Author

I was deploying it from an AML compute instance. Yes, it is Linux.

@rm-1997
Copy link

rm-1997 commented Sep 10, 2024

For me all works fine, BUT: why do the azure open ai resource (and its models) have to be created (deployed) in advance? Why are they not part of the general deployment code (i.e. main.bicep and deploy.sh). I am just asking to get a better understanding here ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants