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

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

未关闭
#40 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
290
派生
152
PR 合并指标
30 天内没有已合并 PR

描述

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
)

贡献指南

这个仓库没有索引到贡献指南

调研方向

先从 provision.yaml 开始,检查 AOAI 和 AI Search 的资源名称环境变量,然后查看 deploy.py,其中会分配 endpoint 角色。部署 endpoint,并验证角色作用域使用的是实际资源名称,且不会发生 resources-not-found 错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
azure, python
领域
authorization, cloud
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。