Unable to create Azure-keyvault-backed secret scope on Azure Databricks

1k Views Asked by At

I am not able to create secret scope on Azure Databricks from Databricks CLI. I run a command like this:

databricks secrets "create-scope" --scope "edap-dev-kv" --scope-backend-type AZURE_KEYVAULT --resource-id "/subscriptions/ba426b6f-65cb-xxxx-xxxx-9a1e1656xxxx/resourceGroups/edap-dev-rg/providers/Microsoft.KeyVault/vaults/edap-dev-kv" --profile profile_edap_dev2_dbx --dns-name "https://edap-dev-kv.vault.azure.net/"

I get error msg:

Error: b'<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>\n<title>
Error 400 io.jsonwebtoken.IncorrectClaimException: 
Expected aud claim to be: 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d, but was: https://management.core.windows.net/.
</title>\n</head>\n<body><h2>HTTP ERROR 400</h2>\n<p>
Problem accessing /api/2.0/secrets/scopes/create. 
Reason:\n<pre>    io.jsonwebtoken.IncorrectClaimException: 
Expected aud claim to be: 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d, 
but was: https://management.core.windows.net/.</pre></p>\n</body>\n</html>\n'

I have tried doing it with both user (personal) and service principal's AAD token. (I've found somewhere that it it should be a AAD token of user account.)
I am able to do it with GUI using same parameters.

1

There are 1 best solutions below

0
On

In your case, the personal access token was issued for incorrect service - it was issued for https://management.core.windows.net/. but it's required that you use resource ID of the Azure Databricks - 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d.

Simplest way to do that is to use az-cli with following command:

az account get-access-token -o tsv --query accessToken \
  --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d