简体   繁体   中英

Generate Azure Databricks Token using Powershell script

I need to generate Azure Databricks token using Powershell script. I am done with creation of Azure Databricks using ARM template, now i am looking to generate Databricks token using powershell script.

Kindly let me know how to create Databricks token using Powershell script

The only way to generate a new token is via the api which requires you to have a token in the first place. Or use the Web ui manually. There is no official powershell commands for databricks, there are some unofficial ones but they still require you to generate a token manually first.

https://github.com/DataThirstLtd/azure.databricks.cicd.tools

Disclaimer I'm the author of these.

UPDATE: these powershell commands can now authenticate using a service principal instead of a bearer token (or can generate a bearer token for you).

so right now there is no way to use the API directly after deploying an Azure Databricks Workspace. I assume that you want to use it as part of an CI/CD pipeline - right? Reason is that you first need to manually create an API token which you can then use for all subsequent API requests. But I will investigate and keep you updated here!

another option is to create it via terraform.

https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs/resources/token

mind you, it creates the token as whomever you az login'd as. so if you az login as yourself (when it spawns a browser asking who to log in as), that's who the token will be created as (assuming that user has permissions in the databricks workspace) and contributor (or custom read role, reader role doesn't grant the right permissions) permissions into the resource group that houses the workspace.

you can always use az login -u username@email.com -p to log in as someone else, assuming that user doesn't have MFA then run the terraform init/plan/apply. mind you, if you have a backend storage, that user also has to have permissions to that backend storage as well so it can create/update any tfstate files stored there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM