Allow module-level subscription id to be used for cross-subscription resource management #694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This change allows the module defined parameter of
subscription_id
to be used for management clients (e.g. when retrieving resources). It does NOT change how authentication to Azure operates.This is helpful when using a credentials file for authentication. The credentials file uses subscription A (authentication), but a playbook needs to retrieve resources which are in subscription B. Adding support for using the module-provided
subscription_id
parameter allows for playbooks to operate under a single set of credentials but supports cross-subscription resource loading (providing the credentials have access to other subscription).Example:
Credentials file:
At runtime, a playbook wants to use resources in a different subscription:
Before this change, registries for subscription A would be retrieved instead of those in subscription B.
ISSUE TYPE
COMPONENT NAME
Any/all.
ADDITIONAL INFORMATION
I am unsure if it's possible to add test coverage for this, but I am using in our environment successfully. The use case is we have a container registry in one subscription which holds all our Docker images. We deploy webapps using the Docker images to multiple subscriptions and need Ansible to support cross-subscription resource loading.