Skip to content

Fix Get-AzAccessToken breaking changes warning#1630

Merged
flanakin merged 10 commits into
devfrom
copilot/fix-987
May 31, 2025
Merged

Fix Get-AzAccessToken breaking changes warning#1630
flanakin merged 10 commits into
devfrom
copilot/fix-987

Conversation

Copilot AI commented May 23, 2025

Copy link
Copy Markdown
Contributor

Problem

PowerShell commands in the FinOps toolkit were showing a warning about upcoming breaking changes in the Get-AzAccessToken cmdlet:

WARNING: Upcoming breaking changes in the cmdlet 'Get-AzAccessToken':
The Token property of the output type will be changed from String to SecureString. Add the [-AsSecureString] switch to avoid the impact of this upcoming breaking change.

  • The change is expected to take effect in Az version: '13.0.0'
  • The change is expected to take effect in Az.Accounts version: '4.0.0'

The Start-FinOpsCostExport command was particularly affected since it makes multiple calls that triggered this warning.

Changes

This PR addresses the warning by modifying the PowerShell module's implementation:

  1. Updated the Invoke-Rest.ps1 private function to correctly handle the upcoming changes to Get-AzAccessToken
  2. Removed the .Token property access from the SecureString returned by Get-AzAccessToken -AsSecureString
  3. Now directly converts the SecureString token to plain text without accessing the property that will be changing

The fix ensures compatibility with both current and future versions of the Az PowerShell module.

Fixes #987.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
Copilot AI and others added 2 commits May 23, 2025 01:53
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
Copilot AI changed the title [WIP] [PowerShell] Stop the Get-AzAccessToken breaking changes warning Fix Get-AzAccessToken breaking changes warning May 23, 2025
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs: Review 👀 PR that is ready to be reviewed label May 25, 2025
@flanakin flanakin marked this pull request as ready for review May 25, 2025 18:20
@flanakin flanakin enabled auto-merge (squash) May 25, 2025 18:21
@flanakin flanakin added this to the 2025-05 - May milestone May 25, 2025
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs: Review 👀 PR that is ready to be reviewed and removed Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity labels May 25, 2025
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>

@flanakin flanakin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good

Comment thread src/powershell/Private/Invoke-Rest.ps1 Outdated
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
@flanakin flanakin dismissed their stale review May 29, 2025 02:32

Changes applied

Comment thread src/powershell/Private/Invoke-Rest.ps1
@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity and removed Needs: Review 👀 PR that is ready to be reviewed labels May 30, 2025
Co-authored-by: flanakin <399533+flanakin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs: Review 👀 PR that is ready to be reviewed and removed Needs: Attention 👋 Issue or PR needs to be reviewed by the author or it will be closed due to no activity labels May 30, 2025
@flanakin flanakin dismissed their stale review May 30, 2025 06:33

Changes applied

@flanakin flanakin disabled auto-merge May 31, 2025 01:34
@flanakin flanakin merged commit e91c411 into dev May 31, 2025
5 checks passed
@flanakin flanakin deleted the copilot/fix-987 branch May 31, 2025 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Review 👀 PR that is ready to be reviewed Skill: DevOps GitHub setup and automation Skill: Documentation Documentation updates Tool: FinOps guide Implementing FinOps guide Tool: PowerShell PowerShell scripts and automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PowerShell] Stop the Get-AzAccessToken breaking changes warning

8 participants