-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support azure cli credentials with multiple
subscription_id
s (#195)
* feat: Support azure cli credentials with multiple `subscription_id`s If the `subscription_id` is specified as module parameter or in the environment then try to find that subscription in either the MSI (existing) or CLI credentials (new). This patch brings those two scenarios in line. * docs: Improve documentation on auth_source * refactor: Move defaults up to class Just trying to make the `__init__` fn a bit slimmer and easier to reason about. * refactor: Use python kwargs instead of passing dict This is an isomorphic change, just using python syntax to accomplish the exact same thing. * refactor: Use ansible builtin `env_fallback` for `auth_source` Ansible modules have a pattern for looking up a module parameter in the environment with precedence of explicit param -> env -> default. Use this pattern to simplify our code here. This shouldn't change any behavior of `auth_source`, just using standard ansible patterns to accomplish it. * style: Split long line No semantic change, just wrapping a long line to be a bit more readable. * refactor: helper fun _get_env Somewhat frequently there is a lookup in the environment for the key that matches a module parameter. This simple helper just encapsulates that to make it a bit easier elsewhere-- lookup the same key in params, credentials, env * fix: typo in log message Co-authored-by: Justin Ossevoort <[email protected]>
- Loading branch information
1 parent
48a5321
commit 7f78fb7
Showing
2 changed files
with
52 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters