Login to Auth0 CLI with Powershell

We have a process where creating an organization requires the creation of a database on our end, the storage of the orgId and so forth. Ideally we would like to create a Powershell script that uses the Auth0 CLI to create the orgs (already tested in regular command prompt) retrieve the orgId and use it to create the databases and update our tracking database with the orgId and orgName. I have encountered difficulty logging in through the CLI through Powershell. Powershell does not want to open the browser window, and using the auth0.exe login --force --no-input command just scrolls the Waiting for login to complete in browser... message. Is there a way to automate the login through the CLI, or barring that is there a better way of automating some management functions in a scripting environment like Powershell?

Hi @Blissitte,

I think the Auth0 CLI is meant to be a user-centric application, which may or may not work for this situation. You could try to log in manually with auth0 login, which should store a refresh token for later use.

If that doesn’t work, you may want to look into using the Deploy CLI Tool, which authenticates as a user-less Machine to Machine application in Auth0.

Let me know if you have questions.

Is the Auth0-Deploy-CLI for making modifications to a tenant or for replicating tenants? It looks like the latter.

It can do either one, that’s why I recommended it. :smile:

Make sure you have "AUTH0_ALLOW_DELETE": false in your config file to prevent destruction of your existing tenant settings/entities.

Then just pass a single org in your tenant yaml.

  - name: "test-org"

I would suggest testing it out on a temporary or test tenant to make sure you understand how everything is working.