Skip to content

Authentication issue fix in AzurePowerShell task #19521

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

Conversation

v-schhabra
Copy link
Contributor

@v-schhabra v-schhabra commented Feb 8, 2024

Task name: AzurePowerShellV5

Description: Pipelines were persisting authentication token while using AzurePowerShellV5 task on Microsoft hosted and Self-Hosted agents.

Documentation changes required: (Y/N) N

Added unit tests: (Y/N) N

Attached related issue: DTS [Pipelines Agents Tasks UI]: pipelines are persisting authentication tokens between runs on self-hosted agents

Checklist:

  • Task version was bumped - please check instruction how to do it
  • Checked that applied changes work as expected

@v-schhabra v-schhabra requested review from manolerazvan and a team as code owners February 8, 2024 16:17
Copy link
Contributor

@onetocny onetocny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR. Please take a look at my comments and address them.

@@ -11,6 +11,9 @@ function convertToNullIfUndefined<T>(arg: T): T|null {
return arg ? arg : null;
}

let input_workingDirectory = tl.getPathInput('workingDirectory', /*required*/ true, /*check*/ true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move this inside the run function? It is not needed in the global scope. You can then remove second initialization of input_workingDirectory on line 41.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as suggested

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, but could you please do the same with tempDirectory as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}


function Disconnect-AzureAndClearContext {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you call the existing Disconnect-AzureAndClearContext from utility.ps1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use that utility as it was written specific to windows and present on common which is not supportable for linux hence we created a new file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the code you copied out from there is exactly the same. It would be worth to extract it to separate shared ps1 file and use it on both places.

@v-schhabra v-schhabra closed this Feb 15, 2024
@v-schhabra v-schhabra deleted the v-user/v-schhabra/auth_fix branch February 15, 2024 12:24
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.

2 participants