I'm getting the same error message when trying to use the REST API as well and have tried about every combination I could think of to get the payload correct. I have tried AAD tokens for a user account, service principal, made those accounts full owners on the Key Vault, tried different names for the AAD Token with no success. Anyone out there, get a working solution?
url = f"{databricks_instance}/api/2.0/secrets/scopes/create"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
payload = {
"scope": scopeName,
"scope_backend_type": "AZURE_KEYVAULT",
"backend_azure_keyvault": {
"resource_id": keyVaultResourceId,
"dns_name": keyVaultDnsName
},
"user_aad_token": aadToken
}
response = requests.post(url, headers=headers, json=payload)
{"error_code":"INVALID_PARAMETER_VALUE","message":"Scope with Azure KeyVault must have userAADToken defined!","details":[{"@type":"type.googleapis.com/google.rpc.RequestInfo","request_id":"de4c03b9-10c1-959b-95e8-dbeabb046fa1","serving_data":""}]}