Skip to content
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

Support Azure CLI login for AzureAD and Azure DevOps #12516

Merged
merged 5 commits into from
May 19, 2020

Conversation

mbrancato
Copy link
Contributor

Allows az login authentication to work even when the identity being used is not authorized to access any Azure resources.

Fixes #11846

@mbrancato
Copy link
Contributor Author

Hi @bishal-pdMSFT, Can you please review and provide feedback on this small but impactful PR?

@bishal-pdMSFT
Copy link
Contributor

Thanks @mbrancato for raising the PR. I will take a look by EOD today.

@bishal-pdMSFT bishal-pdMSFT self-requested a review March 23, 2020 05:57
@bishal-pdMSFT
Copy link
Contributor

@mbrancato one problem with this change is that in release editor, the "Azure subscription" drop down only lists the service connections which are scoped to subscription scope. Hence this change won't prove much useful.

@mbrancato
Copy link
Contributor Author

Hi @bishal-pdMSFT - That may be only a problem with the "release editor". I don't know what that is and don't use this. When writing pipelines with YAML we may specify any service connection by name, and there seems to be no filtering except by type.

So while that may not be seen as a help here, if this change doesn't affect that workflow negatively, it still helps my workflow of using YAML pipelines.

I think the problem is I'm probably using the authentication from this task a bit more broadly than it was originally thought to serve. Specifically, I'm using this for infrastructure builds and we don't use "classic" release pipelines. But in many cases, my service principal does not have direct access to Azure, but it does have identity. And that is what we need, and identity we can validate of the pipeline.

@bishal-pdMSFT
Copy link
Contributor

Yes, for yaml it should work fine.
I was talking about the legacy release pipeline. It has an editor experience where a service connection list of shown. This list is filtered to only show connections which has subscription scope. We can make additional changes to ensure that filtering does not happen.

@bishal-pdMSFT
Copy link
Contributor

@mbrancato I have suggested a couple of more changes which will make it generic so that any ARM service connection scope can be used.

@bishal-pdMSFT
Copy link
Contributor

@issacnitin can you please review this PR

@bishal-pdMSFT
Copy link
Contributor

@mbrancato please update the patch version specified in task.json

@bishal-pdMSFT
Copy link
Contributor

IMO if we remove this filter logic then the change will work even for legacy release editor. What do you think @issacnitin

@issacnitin
Copy link
Contributor

IMO if we remove this filter logic then the change will work even for legacy release editor. What do you think @issacnitin

Yes, that should do it. We should rename the variables and text to say "Azure Service Connection"/"ARM Service Connection", since we're not tied down to subscriptions scoped SPN any more
@mbrancato please run

node make.js build --task AzureCLIV2

from the root of the repository once you've your changes made. Commit the generated files as well. We'll do testing from our side and check-in the PR

@bishal-pdMSFT
Copy link
Contributor

Thanks @mbrancato this looks good to me.
There is one problem though - we are very close to next release of AzureDevOps server. Hence I want to be completely sure that we do not regress any behavior.
@mbrancato hence it would be great if you can try out the updated task and test some scenarios.
@issacnitin please do some testing from your side as well

@issacnitin issacnitin merged commit 5240f79 into microsoft:master May 19, 2020
issacnitin pushed a commit that referenced this pull request May 20, 2020
* Support Azure CLI login for AzureAD and Azure DevOps

* Set subscription only if parameter is set

* Increment task version

Co-authored-by: Mike Brancato <mbrancato@humana.com>
Co-authored-by: Nitin Issac Joy <nijoy@microsoft.com>
issacnitin pushed a commit that referenced this pull request May 20, 2020
* Support Azure CLI login for AzureAD and Azure DevOps

* Set subscription only if parameter is set

* Increment task version

Co-authored-by: Mike Brancato <mbrancato@humana.com>
Co-authored-by: Nitin Issac Joy <nijoy@microsoft.com>
issacnitin pushed a commit that referenced this pull request May 20, 2020
#12946)

* Support Azure CLI login for AzureAD and Azure DevOps (#12516)

* Support Azure CLI login for AzureAD and Azure DevOps

* Set subscription only if parameter is set

* Increment task version

Co-authored-by: Mike Brancato <mbrancato@humana.com>
Co-authored-by: Nitin Issac Joy <nijoy@microsoft.com>

* Support for Azure Management Group in Azure CLI V2 task (#12922)

* Support for management group in Azure CLI

* Updating text

* Review comments

* Updating task version

Co-authored-by: Mike Brancato <mbrancato@users.noreply.github.com>
Co-authored-by: Mike Brancato <mbrancato@humana.com>
issacnitin pushed a commit that referenced this pull request May 20, 2020
#12947)

* Support Azure CLI login for AzureAD and Azure DevOps (#12516)

* Support Azure CLI login for AzureAD and Azure DevOps

* Set subscription only if parameter is set

* Increment task version

Co-authored-by: Mike Brancato <mbrancato@humana.com>
Co-authored-by: Nitin Issac Joy <nijoy@microsoft.com>

* Support for Azure Management Group in Azure CLI V2 task (#12922)

* Support for management group in Azure CLI

* Updating text

* Review comments

* Updating task version

Co-authored-by: Mike Brancato <mbrancato@users.noreply.github.com>
Co-authored-by: Mike Brancato <mbrancato@humana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure CLI v2: "--allow-no-subscriptions"
4 participants