Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This pull request refactors the symbol publishing workflow that uses the internal REST API. It addresses a breaking change introduced by the
Az.Accounts
module update (v5.0.1+) whereGet-AzAccessToken
now returns aSecureString
. Additionally, it improves the structure and robustness of the custom symbol publishing steps.Problem:
Az.Accounts
module. TheGet-AzAccessToken
cmdlet now returns aSecureString
by default, which was incompatible with the previous script that expected a plain string token when setting a pipeline variable.AzurePowerShell@5
task to generate the token and set it as a pipeline variable, and a subsequentpwsh
task to consume this variable and make REST API calls. This separation required converting theSecureString
to plain text before setting the pipeline variable.Solution:
To address these issues and improve the pipeline's design:
AzurePowerShell@5
) task and the "Publish Symbols using internal REST API" (pwsh
) task have been combined into a singleAzurePowerShell@5
task.Get-AzAccessToken
is called, and itsSecureString
output is stored in a local PowerShell variable.SecureString
token is converted to plain text only within the scope of this script and immediately before it's used in theAuthorization
header forInvoke-RestMethod
calls.Key Changes:
SecureString
Management: The token remains aSecureString
for most of its lifetime within the script, reducing exposure.try-catch
blocks have been added around the token retrieval andInvoke-RestMethod
calls for better error reporting and pipeline stability.includePublicSymbolServer
) to ensure correct PowerShell boolean types before JSON serialization.