Azure-Samples / Azure-Samples/rag-data-openai-python-promptflow

Endpoint deployment error due to principal roles given to unfound resources in the RG

Aperta
#40 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
290
Fork
152
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Error when deploying as an endpoint to AI Studio.

Cause: Setting roles for AOAI and AI Search throws the error: Resources not found. The code gives roles based on the connection name, not the resource name.

**Resolution steps:**

1) Add to the provision.yaml:
AZURE_OPENAI_RESOURCE_NAME: "${aoai.aoai_resource_name}" # necessary for the endpoint deployment
AZURE_SEARCH_RESOURCE_NAME: "${search.search_resource_name}" # necessary for the endpoint deployment

This will update the env variables with the name of AOAI and AI Search Resources

2) Modify deploy.py to give roles based on the resource names (not the connection names as originally):

- for AOAI:

scope=f'''/subscriptions/{os.environ["AZURE_SUBSCRIPTION_ID"]}/resourceGroups/{os.environ["AZURE_RESOURCE_GROUP"]}/providers/Microsoft.CognitiveServices/accounts/{os.environ["AZURE_OPENAI_RESOURCE_NAME"]}''',
role_name="Cognitive Services OpenAI User",
principal_id=endpoint.identity.principal_id
)

- for AI Search: scope=f'''/subscriptions/{os.environ["AZURE_SUBSCRIPTION_ID"]}/resourceGroups/{os.environ["AZURE_RESOURCE_GROUP"]}/providers/Microsoft.Search/searchServices/{os.environ["AZURE_SEARCH_RESOURCE_NAME"]}''',
role_name="Search Index Data Contributor",
principal_id=endpoint.identity.principal_id
)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start with provision.yaml to inspect the AOAI and AI Search resource-name environment variables, then review deploy.py where endpoint roles are assigned. Deploy the endpoint and verify that role scopes use the actual resource names and no resources-not-found error occurs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, python
Ambito
authorization, cloud
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.