getporter / az-mixin

An Azure CLI mixin for Porter
https://getporter.org/mixins/az/
Apache License 2.0
0 stars 11 forks source link

Improved login #33

Open carolynvs opened 2 years ago

carolynvs commented 2 years ago

Logging in is a pain right now. You have to specify it for each action, and pass in a bunch of flags and remember to suppress output:

- az: 
      description: "Logging into Azure..."  
      arguments:
        - login
      flags:
        service-principal: ""
        username: "'{{bundle.credentials.AZURE_CLIENT_ID}}'"
        password: "'{{bundle.credentials.AZURE_CLIENT_SECRET}}'"
        tenant: "'{{bundle.credentials.AZURE_TENANT_ID}}'"
      suppress-output: true

We could add a custom login command to the mixin to simplify the default login, which assumes the default environment variable names:

install:
- az:
     login:

In addition, we could have the mixin detect if we are logged in (a file gets stored in ~/.azure after login) before running a command and then automatically logging in if needed.

Doommius commented 1 year ago

It would be awesome if support was added for using azcli credentials like Packer , as you'd be able to use a service principle from azure pipelines and handle permissions that way.

lbergnehr commented 5 months ago

That should be possible now that you can mount the ~/.azure directory into the invocation image.