-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azure_rm_networkinterface module ignores subscription_id parameter #1253
Comments
Looks like the environment variable is being taken in subsequent calls to sub-modules. For example this code fails in the check on the subnet when creating a nic: The error is: |
@pauronda-visma Thank you very much for the question you submitted. First of all, we need to create network cards and subnets, virtual networks must be under the same subscription. To create a resource, we must first obtain credentials and we will also obtain its subscription id. Since it's under the same subscription_id, it's all the same. Thank you! |
kindly ping! |
Hi, the issue was if you define both variables (environment variable and module parameter) and doesn't match. |
The credentials are client credentials for a tenant with multiple subscriptions. We use the credential to authenticate only. Creating vnets and subnets in the separate subscriptions that the user/app has access to. |
@pauronda-visma But we will get the subnet ID from the subscription_id, virtual network name, and subnet name in the credentials. If you want to specify a different subscription_id, we can add the full subnet ID to pass it. Is that okay? |
Yes, I think this would solve the issue when there is a mismatch between the environment variable and the subscription_id module parameter. |
@pauronda-visma We can support this (Added in #1416), but your tenant ID must have access to the permissions of the other subscription_id, if not, an error similar to the one below will appear! Thank you!
|
This would fix it, thank you very much |
SUMMARY
When I use Environment variables with the credentials that include AZURE_SUBSCRIPTION_ID the module parameter subscription_id is ignored.
It produces a mismatch between the subnet (that points to the Environment variable of the credentials) and the NIC that is been created into the subscription id of the module parameter.
It tries to find the subnet into the Environment Variable AZURE_SUBSCRIPTION_ID instead of subscription_id of the module parameter.
To call the module, I pass the subnet_name as a string with the name of the subnet and the virtual_network as a dict with the name and the resource_group (also as name an not with the complete resource ids)
Thank you for your attention and help.
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
The text was updated successfully, but these errors were encountered: