Iryna
09/17/2024, 4:55 PMazure.core.exceptions.HttpResponseError: (AuthorizationFailed) The client '5b691102-d05d-4a6e-a0c0-c0d326e2164a' with object id '5b691102-d05d-4a6e-a0c0-c0d326e2164a' does not have authorization to perform action 'Microsoft.ContainerInstance/containerGroups/delete' over scope '/subscriptions/ee2685ef-33b1-4fbd-8588-432444e3a821/resourceGroups/identity-prefect/providers/Microsoft.ContainerInstance/containerGroups/healthcheck-a7cffced-2a44-40cd-a800-78bc399d2e52' or the scope is invalid. If access was recently granted, please refresh your credentials.
Code: AuthorizationFailed
Marvin
09/17/2024, 4:55 PM/subscriptions/ee2685ef-33b1-4fbd-8588-432444e3a821/resourceGroups/identity-prefect
).
3. Access Control (IAM):
- In the left-hand side menu, choose "Access control (IAM)".
- Click on "+ Add" then "Add role assignment".
4. Assign the Correct Role:
- Choose a role that has delete permissions for container groups (e.g., "Contributor" or a custom role with the specific required permissions like Microsoft.ContainerInstance/containerGroups/delete
).
- Click "Next" and then "+ Select members".
- Type the name of the app registration (AAD app) or service principal and add it.
- Click "Review + Assign".
5. Refresh Credentials:
- If you have recently updated these permissions, ensure that you refresh your credentials or give it a few minutes for the changes to take effect.
For more detailed steps on setting up Azure for Prefect, you can refer to the Prefect documentation:
- Prefect ACI Integration
If the problem persists after ensuring the correct permissions, please let me know!Marvin
09/17/2024, 4:56 PMsh
az role definition create --role-definition '{
"Name": "Container Instances Contributor",
"IsCustom": true,
"Description": "Can create, delete, and monitor container instances.",
"Actions": [
"Microsoft.ManagedIdentity/userAssignedIdentities/assign/action",
"Microsoft.Resources/deployments/*",
"Microsoft.ContainerInstance/containerGroups/*"
],
"NotActions": [],
"AssignableScopes": [
"/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>"
]
}'
2. Assign the Role to the Identity: Once the role is created, assign it to the user-managed identity:
sh
az role assignment create \
--assignee <identity-id> \
--role "Container Instances Contributor" \
--scope /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>
3. Ensure Credentials Are Up-To-Date: If access was granted recently, you might need to refresh the Azure credentials. Sign out and sign in again or use the az account clear
command to clear cached credentials.
4. Update Your ACI Work Pool Configuration: Navigate to the Edit page of your ACI work pool and ensure the identity is correctly referenced. The identity should be added in the following format:
json
["/subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identity-name>"]
For more detailed instructions, you can refer to the Prefect ACI documentation:
- Prefect 2.x: Prefect Azure ACI Worker
- Prefect 3.x: Prefect Azure ACI Worker
If you continue to experience issues, please ensure all the steps are followed correctly and that the identity has been assigned the appropriate roles.
Let me know if there's anything else I can assist you with!