Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->

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

## Version 3.0.5
Expand Down
2 changes: 1 addition & 1 deletion src/Accounts/Accounts/Token/GetAzureRmAccessToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

namespace Microsoft.Azure.Commands.Profile
{
[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")]
[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")]
[Cmdlet(VerbsCommon.Get, AzureRMConstants.AzureRMPrefix + "AccessToken", DefaultParameterSetName = KnownResourceNameParameterSet)]
[OutputType(typeof(PSAccessToken), typeof(PSSecureAccessToken))]
public class GetAzureRmAccessTokenCommand : AzureRMCmdlet
Expand Down
2 changes: 1 addition & 1 deletion src/Accounts/Accounts/help/Az.Accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Enables AzureRm prefix aliases for Az modules.
Exports all the configs into a file so that it can be imported on another machine.

### [Get-AzAccessToken](Get-AzAccessToken.md)
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`.
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`.

### [Get-AzConfig](Get-AzConfig.md)
Gets the configs of Azure PowerShell.
Expand Down
12 changes: 8 additions & 4 deletions src/Accounts/Accounts/help/Get-AzAccessToken.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ schema: 2.0.0
# Get-AzAccessToken

## SYNOPSIS
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`.
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`.
> **_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.

## SYNTAX

Expand All @@ -31,21 +32,21 @@ Get access token

### Example 1 Get the access token for ARM endpoint
```powershell
Get-AzAccessToken
Get-AzAccessToken -AsSecureString
```

Get access token of current account for ResourceManager endpoint

### Example 2 Get the access token for Microsoft Graph endpoint
```powershell
Get-AzAccessToken -ResourceTypeName MSGraph
Get-AzAccessToken -AsSecureString -ResourceTypeName MSGraph
```

Get access token of Microsoft Graph endpoint for current account

### Example 3 Get the access token for Microsoft Graph endpoint
```powershell
Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com/"
Get-AzAccessToken -AsSecureString -ResourceUrl "https://graph.microsoft.com/"
```

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

### -AsSecureString
Specifiy to convert output token as a secure string.
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.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down Expand Up @@ -137,8 +139,10 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## OUTPUTS

### Microsoft.Azure.Commands.Profile.Models.PSAccessToken
The output type is going to be deprecate.

### Microsoft.Azure.Commands.Profile.Models.PSSecureAccessToken
Use `-AsSecureString` to get the token as `SecureString`.

## NOTES

Expand Down