~/ ❯ databricks unity-catalog storage-credentials create --name test \
--az-mi-access-connector-id "/subscriptions/c8a25cfd-bf10-4a03-9deb-eb99c90f251f/resourceGroups/my-resource-group/providers/Microsoft.Databricks/accessConnectors/my-connector-unity-catalog" \
--az-mi-id "/subscriptions/c8a25cfd-bf10-4a03-9deb-eb99c90f251f/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/my-connector-unity-catalog-mi"
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/databricks_cli/sdk/api_client.py", line 166, in perform_query
resp.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://adb-1234567880123456.7.azuredatabricks.net/api/2.1/unity-catalog/storage-credentials
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/databricks", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/databricks_cli/unity_catalog/cred_cli.py", line 114, in wrapper
f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/databricks_cli/configure/config.py", line 67, in decorator
return function(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/databricks_cli/unity_catalog/cred_cli.py", line 166, in create_credential_cli
cred_json = UnityCatalogApi(api_client).create_storage_credential(data, skip_val)
File "/usr/local/lib/python3.10/site-packages/databricks_cli/unity_catalog/api.py", line 103, in create_storage_credential
return self.client.create_storage_credential(cred_spec, skip_validation)
File "/usr/local/lib/python3.10/site-packages/databricks_cli/unity_catalog/uc_service.py", line 175, in create_storage_credential
return self.client.perform_query('POST', url, data=cred_spec, headers=headers)
File "/usr/local/lib/python3.10/site-packages/databricks_cli/sdk/api_client.py", line 174, in perform_query
raise requests.exceptions.HTTPError(message, response=e.response)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://adb-1234567880123456.7.azuredatabricks.net/api/2.1/unity-catalog/storage-credentials
Response from server:
{ 'details': [ { '@type': 'type.googleapis.com/google.rpc.ErrorInfo',
'domain': 'unity-catalog.databricks.com',
'metadata': { 'accessConnectorId': '/subscriptions/c8a25cfd-bf10-4a03-9deb-eb99c90f251f/resourceGroups/my-resource-group/providers/Microsoft.Databricks/accessConnectors/my-connector-unity-catalog'},
'reason': 'UC_STORAGE_CREDENTIAL_INVALID_CLOUD_PERMISSIONS'},
{ '@type': 'type.googleapis.com/google.rpc.RequestInfo',
'request_id': 'eb684711-61ca-441b-ad34-8acc1e632b48',
'serving_data': ''}],
'error_code': 'PERMISSION_DENIED',
'message': 'Creating a storage credential requires the contributor role over '
'the corresponding access connector with ID '
'/subscriptions/c8a25cfd-bf10-4a03-9deb-eb99c90f251f/resourceGroups/my-resource-group/providers/Microsoft.Databricks/accessConnectors/my-connector-unity-catalog. '
'Please contact your account admin.'}
Describe the issue
I'm trying to create a new storage credential in Unity Catalog using my personal user that has Unity Metastore Admin permissions. Due to security reasons, our organization does not allow personal users to have the built-in "Contributor" role. Instead, we assign a custom one, which is almost identical to the built-in role. Hence, my personal identity does not have built-in "Contributor" role.
The custom role definition is as follows:
The attempt to create a storage credential fails with the following error:
Creation of a storage credential required the contributor role over the corresponding access connector with ID '...'. Please contact your account admin.I believe that the service performs role assignment lookups only by ID and does not check that my user has the necessary permissions to perform the action.
Steps to reproduce the behavior
Custom Contributorrole definitionExpected Behavior
Creation of the storage credential succeeded since the identity used has enough access permissions.
Actual Behavior
The attempt of a storage credential creation is failing with the following error:
Creation of a storage credential required the contributor role over the corresponding access connector with ID '...'. Please contact your account admin.OS and CLI version
Is this a regression?
n.a.
Debug Logs
n.a.