question

GuntaLedina-8853 avatar image
0 Votes"
GuntaLedina-8853 asked ·

Azure Databricks mounts using Azure KeyVault-backed scope -- SP secret update

Issue:

  1. Mounted ADLS gen2 container using service principal secret as secret from Azure Key Vault-backed secret scope. All good, can access the data.

  2. Deleted secret from service principal in AAD, added new, updated Azure Key Vault secret (added the new version, disabled the old secret). All was still good, could access the data.

  3. Restarted cluster. Unable to access mount point, error: “AADToken: HTTP connection failed for getting token from AzureAD. Http response: 401 Unauthorized”

  4. Unmount/mount using the same config helped.

Is there a way to refresh the secret used for mount point that I could add to init scripts to avoid this issue? I would rather avoid unmounting/mounting all mount points in init scripts and was hoping that there is something like dbutils.fs.refreshMounts() (refreshMounts didn't help with this) that would help.

I mounted ADLS Gen2 using service principal, oauth2.0, and azure key vault-backed secret scope, following this documentation: https://docs.microsoft.com/en-us/azure/databricks/data/data-sources/azure/azure-datalake-gen2#mount-azure-data-lake-gen2

I was also wondering - how long does the token live for accessing the ADLS Gen2? I changed the service principal secret (deleted previous one, added new) from AAD and was able to access the mnt point data for more than 12 hours after that (until cluster was restarted).

azure-databricks
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GuntaLedina-8853, Could you please share the complete code which you are trying and also share the stack trace of the error message which your experiencing?

0 Votes 0 · ·

1 Answer

JorgKlein-3285 avatar image
2 Votes"
JorgKlein-3285 answered ·

Hi GuntaLedina-8853, this is a known limitation. Whenever you create a mount point using credentials coming from an AKV backed secret scope, the credentials will be stored in the mount point and will never be refreshed again. This is a one-time read activity on mount point creation time. So each time you rotate credentials in AKV you need to re-create the mount points to refresh the credentials there.

You could add this as a feature request: https://feedback.azure.com/forums/909463-azure-databricks

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.