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

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

Open
amaliaspataru opened this issue Oct 16, 2024 · 0 comments

Comments

@amaliaspataru
Copy link

amaliaspataru commented Oct 16, 2024

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

  1. 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
    )

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

1 participant