Skip to content

No Login Output Flag #14156

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

Closed
doittjdoughty opened this issue Dec 31, 2020 · 16 comments
Closed

No Login Output Flag #14156

doittjdoughty opened this issue Dec 31, 2020 · 16 comments

Comments

@doittjdoughty
Copy link

Utility.throwIfError(tl.execSync("az", `login --service-principal -u "${servicePrincipalId}" --password="${escapedCliPassword}" --tenant "${tenantId}" --allow-no-subscriptions`), tl.loc("LoginFailed"));

We have dozens of pipelines running over 100 Azure subscriptions and each time our pipelines run the AzureCLI@2 task is used to log into Azure all of our subscriptions are logged to the pipeline output. This means that the important pipeline content that we care about usually starts on line 1620. Can the line of code referenced here be updated with "--output none" as an option. Below is the sample step included in our pipelines:

      - task: AzureCLI@2
        displayName: 'The Task'
        inputs:
          scriptType: bash
          scriptLocation: inlineScript
          azureSubscription: $(azure_service_connection)
          addSpnToEnvironment: true
          inlineScript: |
            export ARM_ENVIRONMENT=$(arm_environment)
            export ARM_CLIENT_ID=$servicePrincipalId
            export ARM_CLIENT_SECRET=$servicePrincipalKey
            export ARM_SUBSCRIPTION_ID=$(arm_subscription_id)
            export ARM_TENANT_ID=$tenantId
@github-actions github-actions bot added Area: ABTT Akvelon Build Tasks Team area of work Area: Release Task: Bash triage labels Dec 31, 2020
@EzzhevNikita EzzhevNikita added environment:need-to-triage Issues need to be triage by environment-deployment team and removed Area: ABTT Akvelon Build Tasks Team area of work Task: Bash labels Dec 31, 2020
@chshrikh chshrikh removed the environment:need-to-triage Issues need to be triage by environment-deployment team label Jan 4, 2021
@doittjdoughty
Copy link
Author

Hi @bishal-pdMSFT Any thoughts on this? It would be extremely helpful to organizations/enterprises with more than one Azure subscription to limit the login output to a few lines instead of thousands of lines.

@doittjdoughty
Copy link
Author

@bishal-pdMSFT any updates one this? Seems like a simple enough fix that would add a value to the login task.

@ashwinsangem
Copy link
Contributor

@doittjdoughty, I will take a look and get back.

@doittjdoughty
Copy link
Author

@ashwinsangem Awesome! Thank you!

@georambo
Copy link

@ashwinsangem , Hi 👋 . Sorry to poke, but just wondering if any updates to this. It is also very useful feature to our team. The task works great, but the output is so verbose, it makes reviewing the logs very difficult for all jobs we use this for. We have 100's of subscriptions that spam the logs. Much appreciated.

@maxim-nyc3
Copy link

@ashwinsangem ,
Hi did you get a chance to look and modify this?

@doittjdoughty
Copy link
Author

@ashwinsangem and @bishal-pdMSFT any update on this? This would be a big help to our organization.

@ashwinsangem
Copy link
Contributor

@doittjdoughty, my apologies for the delay. I'll discuss this with our team and prioritize this.

@doittjdoughty
Copy link
Author

Awesome! Thank you @ashwinsangem.

@tejasd1990
Copy link
Contributor

tejasd1990 commented Mar 26, 2021

Hi @doittjdoughty @georambo @maxim-nyc3 ,
apart from command line options, cli configuration can also be set through environment variables.
A workaround to fix this is to set the AZURE_CORE_OUTPUT environment variable to none(you can also set it to table, which prints 1 line per subscription). The task has an environment variables section which you can use. A side effect would be that your script output would also get suppressed. To avoid that, you can set the environment variable back to empty string(or any other value you want) at the beginning of your script. Let us know if this works.

Since other customers have not yet reported this issue, and the workaround should work, we won't likely be modifying the task for this.

@georambo
Copy link

Hi @tejasd1990 , it seems i have gotten that to work by setting var AZURE_CORE_OUTPUT=none in our pipeline, then as you said, setting back to empty string in our azure cli script. I have concerns w/ this solution though, as it will be a global var, and suppress output for all azure commands? so now anywhere we want output, we need to override this value?

it would be much nicer if we could just suppress the output for the login command, or as a flag of the task instead. I also dont see ability to pass ENV variable just to the azure cli task from the docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-cli?view=azure-devops

@doittjdoughty
Copy link
Author

@tejasd1990 I completely agree with @georambo. After reviewing the code it is a simple fix to add a var to hold a bool that can then be appended to the end of the login function that would suppress the output. We use a lot of azure cli calls in our pipelines and this means we have to constantly switch back and forth to view content.

@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

@sopelt
Copy link

sopelt commented Jun 8, 2022

@bishal-pdMSFT I think this should be reopened and responded to as there have been multiple follow-ups/similar requests (e.g. #15845 and #15970 )

@piotr-gbyliczek
Copy link
Contributor

piotr-gbyliczek commented Aug 8, 2022

I've come across this issue too and found it frustrating.

I have attempted to create a change to facilitate this, please contribute as I'm not much of a developer, just a frustrated sysadmin: #16701

Especially looking to validate my understanding on how input variable can be used in private function (loginAzureRM), and writing some tests :)

@syedhamjath
Copy link

Please reopen this issues, there is no harm in reducing the log size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests