Skip to content

Commit ebc7194

Browse files
Get the access token for Microsoft Graph (#16006)
* Get the access token for Microsoft Graph * Sort resouce type alphabetically * Remove MSGraph from PSAzureEnvironment Co-authored-by: Yunchi Wang <[email protected]>
1 parent 058b464 commit ebc7194

File tree

5 files changed

+32
-28
lines changed

5 files changed

+32
-28
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+
* Supported getting the access token for Microsoft Graph.
2223
* Added AuthorizeRequestDelegate to allow service module to adjust token audience.
2324
* Utilized [AssemblyLoadContext](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.loader.assemblyloadcontext) to resolve assembly conflict issues in PowerShell.
2425
* Updated Azure.Core from 1.16.0 to 1.19.0.

src/Accounts/Accounts/Token/GetAzureRmAccessToken.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public class GetAzureRmAccessTokenCommand : AzureRMCmdlet
4545

4646
[Parameter(ParameterSetName = KnownResourceNameParameterSet,
4747
Mandatory = false,
48-
HelpMessage = "Optional resouce type name, supported values: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, OperationalInsights, ResourceManager, Storage, Synapse. Default value is Arm if not specified.")]
48+
HelpMessage = "Optional resource type name, supported values: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, MSGraph, OperationalInsights, ResourceManager, Storage, Synapse. Default value is Arm if not specified.")]
4949
[PSArgumentCompleter(
5050
SupportedResourceNames.AadGraph,
51+
SupportedResourceNames.MSGraph,
5152
SupportedResourceNames.AnalysisServices,
5253
SupportedResourceNames.Arm,
5354
SupportedResourceNames.Attestation,

src/Accounts/Accounts/Utilities/SupportedResourceNames.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ internal class SupportedResourceNames
2222
{
2323
public const string Arm = "Arm";
2424
public const string AadGraph = "AadGraph";
25+
public const string MSGraph = "MSGraph";
2526
public const string Batch = "Batch";
2627
public const string DataLake = "DataLake";
2728
public const string KeyVault = "KeyVault";
@@ -43,6 +44,7 @@ static SupportedResourceNames()
4344
DataPlaneResourceNameMap = new Dictionary<string, string>()
4445
{
4546
{ AadGraph, AzureEnvironment.Endpoint.GraphEndpointResourceId },
47+
{ MSGraph, AzureEnvironment.ExtendedEndpoint.MicrosoftGraphEndpointResourceId },
4648
{ Batch, AzureEnvironment.Endpoint.BatchEndpointResourceId },
4749
{ DataLake, AzureEnvironment.Endpoint.DataLakeEndpointResourceId },
4850
{ KeyVault, AzureEnvironment.Endpoint.AzureKeyVaultServiceEndpointResourceId },

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@ Get access token
2929

3030
## EXAMPLES
3131

32-
### Example 1 Get raw access token for ARM endpoint
32+
### Example 1 Get the access token for ARM endpoint
3333
```powershell
3434
PS C:\> Get-AzAccessToken
3535
```
3636

37-
Get access token of ResourceManager endpoint for current account
37+
Get access token of current account for ResourceManager endpoint
3838

39-
### Example 2 Get raw access token for AAD graph endpoint
39+
### Example 2 Get the access token for Microsoft Graph endpoint
4040
```powershell
41-
PS C:\> Get-AzAccessToken -ResourceTypeName AadGraph
41+
PS C:\> Get-AzAccessToken -ResourceTypeName MSGraph
4242
```
4343

44-
Get access token of AAD graph endpoint for current account
44+
Get access token of Microsoft Graph endpoint for current account
4545

46-
### Example 3 Get raw access token for AAD graph endpoint
46+
### Example 3 Get the access token for Microsoft Graph endpoint
4747
```powershell
48-
PS C:\> Get-AzAccessToken -ResourceUrl "https://graph.windows.net/"
48+
PS C:\> Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com/"
4949
```
5050

51-
Get access token of AAD graph endpoint for current account
51+
Get access token of Microsoft Graph endpoint for current account
5252

5353
## PARAMETERS
5454

@@ -68,7 +68,7 @@ Accept wildcard characters: False
6868
```
6969
7070
### -ResourceTypeName
71-
Optional resouce type name, supported values: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, OperationalInsights, ResourceManager, Storage, Synapse. Default value is Arm if not specified.
71+
Optional resource type name, supported values: AadGraph, AnalysisServices, Arm, Attestation, Batch, DataLake, KeyVault, MSGraph, OperationalInsights, ResourceManager, Storage, Synapse. Default value is Arm if not specified.
7272
7373
```yaml
7474
Type: System.String
@@ -83,7 +83,7 @@ Accept wildcard characters: False
8383
```
8484
8585
### -ResourceUrl
86-
Resource url for that you're requesting token, e.g. 'http://graph.windows.net/'.
86+
Resource url for that you're requesting token, e.g. 'https://graph.microsoft.com/'.
8787
8888
```yaml
8989
Type: System.String

tools/Common.Netcore.Dependencies.targets

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
<ItemGroup>
44
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.23"/>
55
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19"/>
6-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.45-preview"/>
7-
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.45-preview"/>
8-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.45-preview"/>
9-
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.3.45-preview"/>
10-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.3.45-preview"/>
11-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.3.45-preview"/>
12-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.3.45-preview"/>
13-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.3.45-preview"/>
14-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.3.45-preview"/>
15-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.3.45-preview"/>
16-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.3.45-preview"/>
17-
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.3.45-preview"/>
18-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.3.45-preview"/>
19-
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.45-preview"/>
20-
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.45-preview"/>
21-
<PackageReference Include="Microsoft.Azure.PowerShell.Common.Share" Version="1.3.45-preview"/>
6+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Aks" Version="1.3.47-preview"/>
7+
<PackageReference Include="Microsoft.Azure.PowerShell.Authentication.Abstractions" Version="1.3.47-preview"/>
8+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Authorization" Version="1.3.47-preview"/>
9+
<PackageReference Include="Microsoft.Azure.PowerShell.Common" Version="1.3.47-preview"/>
10+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Compute" Version="1.3.47-preview"/>
11+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Graph.Rbac" Version="1.3.47-preview"/>
12+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.KeyVault" Version="1.3.47-preview"/>
13+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Monitor" Version="1.3.47-preview"/>
14+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Network" Version="1.3.47-preview"/>
15+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.PolicyInsights" Version="1.3.47-preview"/>
16+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.ResourceManager" Version="1.3.47-preview"/>
17+
<PackageReference Include="Microsoft.Azure.PowerShell.Storage" Version="1.3.47-preview"/>
18+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Storage.Management" Version="1.3.47-preview"/>
19+
<PackageReference Include="Microsoft.Azure.PowerShell.Strategies" Version="1.3.47-preview"/>
20+
<PackageReference Include="Microsoft.Azure.PowerShell.Clients.Websites" Version="1.3.47-preview"/>
21+
<PackageReference Include="Microsoft.Azure.PowerShell.Common.Share" Version="1.3.47-preview"/>
2222
</ItemGroup>
2323
<ItemGroup>
2424
<PackageReference Include="Azure.Core" Version="1.19.0"/>
@@ -36,7 +36,7 @@
3636
<PackageReference Include="PowerShellStandard.Library" Version="5.1.0" PrivateAssets="All" />
3737
</ItemGroup>
3838
<PropertyGroup>
39-
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.45-preview\tools\</StorageToolsPath>
39+
<StorageToolsPath>$(NugetPackageRoot)\microsoft.azure.powershell.storage\1.3.47-preview\tools\</StorageToolsPath>
4040
</PropertyGroup>
4141
<ItemGroup Condition="'$(OmitJsonPackage)' != 'true'">
4242
<PackageReference Include="Newtonsoft.Json" Version="10.0.3"/>

0 commit comments

Comments
 (0)