You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: infra/scripts/run_create_index_scripts.sh
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,24 @@ fi
83
83
echo"User already has the Azure AI User role."
84
84
fi
85
85
86
+
### Assign Cognitive Services OpenAI User role to the signed in user ###
87
+
88
+
# Check if the user has the Cognitive Services OpenAI User role
89
+
echo"Checking if user has the Cognitive Services OpenAI User role"
90
+
role_assignment=$(MSYS_NO_PATHCONV=1 az role assignment list --role 5e0bd9bd-7b93-4f28-af87-19fc36ad61bd --scope $aif_resource_id --assignee $signed_user_id --query "[].roleDefinitionId" -o tsv)
91
+
if [ -z"$role_assignment" ];then
92
+
echo"User does not have the Cognitive Services OpenAI User role. Assigning the role."
93
+
MSYS_NO_PATHCONV=1 az role assignment create --assignee $signed_user_id --role 5e0bd9bd-7b93-4f28-af87-19fc36ad61bd --scope $aif_resource_id --output none
94
+
if [ $?-eq 0 ];then
95
+
echo"Cognitive Services OpenAI User role assigned successfully."
96
+
else
97
+
echo"Failed to assign Cognitive Services OpenAI User role."
98
+
exit 1
99
+
fi
100
+
else
101
+
echo"User already has the Cognitive Services OpenAI User role."
102
+
fi
103
+
86
104
### Assign Search Index Data Contributor role to the signed in user ###
0 commit comments