Skip to content

Commit 59fb486

Browse files
msJinLeividai-msft
andauthored
Delay the Get-AzAccessToken Breaking Change (#26625)
* Delay the Get-AzAccessToken breaking change * Update the doc of Get-AzAccessToken * Address review comments * Address review comments --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent 1ebce47 commit 59fb486

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Updated the `Get-AzAccessToken` breaking change warning message.
2223
* Added Long Running Operation Support for Invoke-AzRest command.
2324

2425
## Version 3.0.5

src/Accounts/Accounts/Token/GetAzureRmAccessToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
namespace Microsoft.Azure.Commands.Profile
3131
{
32-
[GenericBreakingChangeWithVersion("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.", "13.0.0", "4.0.0")]
32+
[GenericBreakingChangeWithVersion("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.", "14.0.0", "4.0.0")]
3333
[Cmdlet(VerbsCommon.Get, AzureRMConstants.AzureRMPrefix + "AccessToken", DefaultParameterSetName = KnownResourceNameParameterSet)]
3434
[OutputType(typeof(PSAccessToken), typeof(PSSecureAccessToken))]
3535
public class GetAzureRmAccessTokenCommand : AzureRMCmdlet

src/Accounts/Accounts/help/Az.Accounts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Enables AzureRm prefix aliases for Az modules.
6060
Exports all the configs into a file so that it can be imported on another machine.
6161

6262
### [Get-AzAccessToken](Get-AzAccessToken.md)
63-
Get raw access token. When using -ResourceUrl, please make sure the value does match current Azure environment. You may refer to the value of `(Get-AzContext).Environment`.
63+
Get secure access token. When using -ResourceUrl, please make sure the value does match current Azure environment. You may refer to the value of `(Get-AzContext).Environment`.
6464

6565
### [Get-AzConfig](Get-AzConfig.md)
6666
Gets the configs of Azure PowerShell.

src/Accounts/Accounts/help/Get-AzAccessToken.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ schema: 2.0.0
88
# Get-AzAccessToken
99

1010
## SYNOPSIS
11-
Get raw access token. When using -ResourceUrl, please make sure the value does match current Azure environment. You may refer to the value of `(Get-AzContext).Environment`.
11+
Get secure raw access token. When using -ResourceUrl, please make sure the value does match current Azure environment. You may refer to the value of `(Get-AzContext).Environment`.
12+
> **_NOTE:_** The current default output token type is going to be changed from plain text `String` to `SecureString` for security. Please use `-AsSecureString` to migrate to the secure behaviour before the breaking change takes effects.
1213
1314
## SYNTAX
1415

@@ -31,21 +32,21 @@ Get access token
3132

3233
### Example 1 Get the access token for ARM endpoint
3334
```powershell
34-
Get-AzAccessToken
35+
Get-AzAccessToken -AsSecureString
3536
```
3637

3738
Get access token of current account for ResourceManager endpoint
3839

3940
### Example 2 Get the access token for Microsoft Graph endpoint
4041
```powershell
41-
Get-AzAccessToken -ResourceTypeName MSGraph
42+
Get-AzAccessToken -AsSecureString -ResourceTypeName MSGraph
4243
```
4344

4445
Get access token of Microsoft Graph endpoint for current account
4546

4647
### Example 3 Get the access token for Microsoft Graph endpoint
4748
```powershell
48-
Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com/"
49+
Get-AzAccessToken -AsSecureString -ResourceUrl "https://graph.microsoft.com/"
4950
```
5051

5152
Get access token of Microsoft Graph endpoint for current account
@@ -54,6 +55,7 @@ Get access token of Microsoft Graph endpoint for current account
5455

5556
### -AsSecureString
5657
Specifiy to convert output token as a secure string.
58+
Please always use the parameter for security purpose and to avoid the upcoming breaking chang and refer to [Frequently asked questions about Azure PowerShell](https://learn.microsoft.com/en-us/powershell/azure/faq) for how to convert from `SecureString` to plain text.
5759

5860
```yaml
5961
Type: System.Management.Automation.SwitchParameter
@@ -137,8 +139,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
137139
## OUTPUTS
138140
139141
### Microsoft.Azure.Commands.Profile.Models.PSAccessToken
142+
The output type is going to be deprecate.
140143
141144
### Microsoft.Azure.Commands.Profile.Models.PSSecureAccessToken
145+
Use `-AsSecureString` to get the token as `SecureString`.
142146

143147
## NOTES
144148

0 commit comments

Comments
 (0)