-
Notifications
You must be signed in to change notification settings - Fork 334
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
Unable to use azure_rm_aduser_info
or azure_rm_adgroup_info
: Insufficient privileges to complete the operation.
#573
Comments
@coleneubauer - any ideas? |
azure_rm_adgroup_info
: Insufficient privileges to complete the operation.azure_rm_aduser_info
or azure_rm_adgroup_info
: Insufficient privileges to complete the operation.
@l3ender Thank you for submitting this issue and we will find out the cause as soon as possible. |
From my research, I've found the Azure Active Directory Graph API permission This brings up another question, however: when adding the permission, I see the following warning:
Should a separate issue be opened for this collection using the deprecated APIs? |
@l3ender We are planning to upgrade all the APIs, the old ones will no longer be used, so we can ignore the old ones. Thank you very much! |
Thank you! When this is done, please note it in the release notes as it is a breaking change in which a different API permission will need to be granted for account/service principal. Thanks! |
Apologies for the accidental close! I will keep open as perhaps a documentation PR should be added for these modules. |
@l3ender Can you set "auth_source: cli" in the playbook to retry? The current 'ad' related modules only support CLI Credentials (az login). Thank you very much! |
@Fred-sun I was able to make the modules work with a credentials file. The issue was that the service principal I was using didn't have the necessary permissions (it seems they aren't granted by default). Once I configured the SP with the above API access, our playbook worked as expected with a credentials file. I kept the issue open because it seems good to add notes in documentation (either for the modules, authentication setup, or both). Thank you! |
Sorry for attaching to this old issue - can create a new one if desired -- I use AWX to run all my ansible modules, and use an attached credential type of "Microsoft Azure Resource Manager" that has my Service Principal ID/Secret to authenticate with Azure. From reading comments above, it seems I need to set
in my task, which I've never had to do before. This is now causing me grief in the azure_rm_adgroup module task, because it: Could not retrieve credential from local cache for service principal Likely because I'm using a remote machine to run this job, which doesn't 'hold' onto my credentials from play to play in the local venv. Ideas on how to solve this? Without specifying the auth_source on other azcollection modules, I have no issues building Azure Cloud infrastructure. I simply set these env vars and everything works fine:
But it seems this particular azure_rm_adgroup module doesn't work that way... Has anyone gotten this module to work from AWX, using a Service Principal Credential? |
@johnpetersjr Sorry for the slow response. I can't speak exactly to using I'm not sure if it matters, but our job template is configured to run on a "localhost" inventory, i.e. the same node as where Tower is installed. Hope that helps! |
Is |
I gave the global administrator role in Azure AD for the MSI virtual machine. But still getting that error "failed to get ad group info Access Token missing or malformed."
Versions:
Error:
Howevere, with the same tenant id and subs, using the msi, create resource module works fine:
|
Well, I found a way to add the Directory.Read.All permissions for the MSI from here: |
Because all the apis need to be upgraded, it's a big project that we're working on. Thank you very much! |
@l3ender @radhikari-arch It has support mscrosoft gaph in PR #1112, Please review! Thank you very much! |
I tried the codes on Fred-sun:Add_msgrpah_support, it works great 👍 👍
|
@felixmarch Thanks for your test! I will push to merge as soon as possible! |
Hi @Fred-sun I tried azure_rm_msuser to add new user like this
During the run, I got error like this:
Any steps I miss here? 🤔 |
@felixmarch I added a judgment on the creation failure and returned an error message, please try again! Thank you very much! |
1 similar comment
@felixmarch I added a judgment on the creation failure and returned an error message, please try again! Thank you very much! |
Cool, able to identify the error detail now. 👍 👍
Further check, it was caused by unsupported characters in mailNickname, similar to what reported in this forum After removing the offending chars, it works fine then. Also observed certain attributes like given_name, surname, usage_location were no longer supported.
It may be good in future to have custom attributes similar to what is provided in the community.windows.win_domain_user module. 😊 |
Is this "give_name" typos? (not "given_name"?) 🤔 |
I noticed the update logic (the "should_update" flag in azure_rm_aduser.py) was not implemented yet in azure_rm_msuser.py. So, when I tried to update the "display_name" against existing "user_principal_name", I got error like this:
Hopefully the incoming work will address it 😊 |
@felixmarch Thanks for your advice, The spelling errors has update. This module does not support updating for the time being. If there is a good way, it will be improved. Thanks! |
commit as bellow! |
@l3ender azure-graphrbac has beed deprecated, and migrate to msgraph-sdk. It has support in v2.1.0. I will closed it! If you have any question. Please repoen a new! Thank you very much! |
SUMMARY
I am unable to use the
azure_rm_adgroup_info
orazure_rm_aduser_info
modules. They report:I am using a service principal which has Owner access for the subscription and looks like it has sufficient API access for user information:
ISSUE TYPE
COMPONENT NAME
azure_rm_adgroup_info
azure_rm_aduser_info
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
-> ansible-config dump --only-changed DISPLAY_SKIPPED_HOSTS(/Users/ross/repos/azure-config/ansible.cfg) = False
OS / ENVIRONMENT
Mac OS Big Sur 11.4.
STEPS TO REPRODUCE
I am testing using the following playbook:
EXPECTED RESULTS
I would be able to retrieve results of groups in the tenant.
ACTUAL RESULTS
Module fails with error.
Reference: #423.
The text was updated successfully, but these errors were encountered: