-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Implement project pulling from Azure DevOps using Service Principals #14628
Implement project pulling from Azure DevOps using Service Principals #14628
Conversation
7d03a68
to
725827b
Compare
@@ -47,6 +82,7 @@ | |||
force: "{{ scm_clean }}" | |||
track_submodules: "{{ scm_track_submodules | default(omit) }}" | |||
accept_hostkey: "{{ scm_accept_hostkey | default(omit) }}" | |||
environment: "{{ git_environment | default({}) }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to do something similar in #14190, just to link it.
@AlanCoding is there way for us to test this or is there anything we would need integration wise? I think once the collection PR merges it would be good to move to that implementation @puiterwijk. The collection is already part of the awx-ee so it is already included in base installs. |
725827b
to
58f7150
Compare
@thedoubl3j Yeah, I had seen that that collection is already in the EE, that's why I even put in the effort to add support for it there :). Regarding testing this PR: it'll require an Azure account with DevOps and a service principal that has access (see the instructions in my commit message/github summary). |
58f7150
to
058c386
Compare
cc @CFSNM |
Hey @puiterwijk! While I was testing out these changes and creating new automated tests for this. I noticed when trying to create a project with the credential for the azure service principal, the project ends up having the credential be empty (when using awxkit). I was going through the awxkit code that our tests repository use and in order for the tests I added to work with this credential and project creation. I had to add the following to the conditional: if credential.ds.credential_type.namespace not in ('scm', 'insights', 'azure_rm'): https://github.com/ansible/awx/blob/devel/awxkit/awxkit/api/pages/projects.py#L52 Would you be able to make this change within this PR? |
058c386
to
4f5754b
Compare
@ryankwilliams Hi, sorry for the delayed reply, but I just pushed the change! |
@puiterwijk Thank you for making the change! |
4f5754b
to
0bc75e1
Compare
@thedoubl3j @ryankwilliams I've updated this PR to use the collection version for token retrieval. |
0bc75e1
to
061b17f
Compare
Allow looking up a credential with one of multiple type IDs. Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
Allow selecting an Azure Resource Manager credential for Git-based SCMs. This is in order to enable using Azure Service Principals for project updates. Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
This adds support for using an Azure Service Principal for project updates. Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
061b17f
to
fa1829b
Compare
@puiterwijk is this ready for merging? |
@dmzoneill I think it is, yes. I've been waiting for review and someone to merge it or provide feedback. |
LGTM! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Reverting this PR due to test failure, please open the PR again. |
…ncipals (ansible#14628)" This reverts commit 2e2cd7f.
…nsible#14628) * Credential Lookup with multiple types Allow looking up a credential with one of multiple type IDs. * Allow Azure cred for SCM Allow selecting an Azure Resource Manager credential for Git-based SCMs. This is in order to enable using Azure Service Principals for project updates. * Implement Azure Service Principal Git This adds support for using an Azure Service Principal for project updates. --------- Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
ansible#14977) Revert "Implement project pulling from Azure DevOps using Service Principals (ansible#14628)" This reverts commit 2e2cd7f.
…nsible#14628) * Credential Lookup with multiple types Allow looking up a credential with one of multiple type IDs. * Allow Azure cred for SCM Allow selecting an Azure Resource Manager credential for Git-based SCMs. This is in order to enable using Azure Service Principals for project updates. * Implement Azure Service Principal Git This adds support for using an Azure Service Principal for project updates. --------- Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
ansible#14977) Revert "Implement project pulling from Azure DevOps using Service Principals (ansible#14628)" This reverts commit 2e2cd7f.
SUMMARY
This adds support for syncing a project from Azure DevOps using an Azure Service Principal.
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
In order to use this feature, create an Azure Resource Manager type secret, and assign this to the project (this PR allows attaching either an scm or azure_rm secret to projects).
The associated service principal must have Basic level access to the DevOps organization, and at least Reader level access to the Project.
Note that the current implementation uses
ansible.builtin.uri
to retrieve an access token.I have submitted ansible-collections/azure#1318 to implement this as a separate Ansible module, after which this could be replaced by: