Skip to content

Commit

Permalink
add RequestedAccessTokenVersion parameter in cmdlets New/Update-AzADA…
Browse files Browse the repository at this point in the history
…pplication (#26886)
  • Loading branch information
JoyerJin authored Dec 30, 2024
1 parent 302eee4 commit f071717
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 30 deletions.
2 changes: 2 additions & 0 deletions src/Resources/MSGraph.Autorest/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
license.txt
/*.ps1
/*.psd1
/*.ps1xml
/*.psm1
/*.snk
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/MSGraph.Autorest/Az.MSGraph.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.MSGraph.private.dll'
FormatsToProcess = './Az.MSGraph.format.ps1xml'
FunctionsToExport = 'Add-AzADAppPermission', 'Add-AzADGroupMember', 'Get-AzADAppCredential', 'Get-AzADAppFederatedCredential', 'Get-AzADApplication', 'Get-AzADAppPermission', 'Get-AzADGroup', 'Get-AzADGroupMember', 'Get-AzADGroupOwner', 'Get-AzADOrganization', 'Get-AzADServicePrincipal', 'Get-AzADServicePrincipalAppRoleAssignment', 'Get-AzADSpCredential', 'Get-AzADUser', 'New-AzADAppCredential', 'New-AzADAppFederatedCredential', 'New-AzADApplication', 'New-AzADGroup', 'New-AzADGroupOwner', 'New-AzADServicePrincipal', 'New-AzADServicePrincipalAppRoleAssignment', 'New-AzADSpCredential', 'New-AzADUser', 'Remove-AzADAppCredential', 'Remove-AzADAppFederatedCredential', 'Remove-AzADApplication', 'Remove-AzADAppPermission', 'Remove-AzADGroup', 'Remove-AzADGroupMember', 'Remove-AzADGroupOwner', 'Remove-AzADServicePrincipal', 'Remove-AzADServicePrincipalAppRoleAssignment', 'Remove-AzADSpCredential', 'Remove-AzADUser', 'Update-AzADAppFederatedCredential', 'Update-AzADApplication', 'Update-AzADGroup', 'Update-AzADServicePrincipal', 'Update-AzADServicePrincipalAppRoleAssignment', 'Update-AzADUser', '*'
AliasesToExport = 'Get-AzADServicePrincipalCredential', 'New-AzADServicePrincipalCredential', 'Remove-AzADServicePrincipalCredential', 'Set-AzADApplication', 'Set-AzADServicePrincipal', 'Set-AzADUser', '*'
FunctionsToExport = 'Add-AzADAppPermission', 'Add-AzADGroupMember', 'Get-AzADAppCredential', 'Get-AzADAppFederatedCredential', 'Get-AzADApplication', 'Get-AzADAppPermission', 'Get-AzADGroup', 'Get-AzADGroupMember', 'Get-AzADGroupOwner', 'Get-AzADOrganization', 'Get-AzADServicePrincipal', 'Get-AzADServicePrincipalAppRoleAssignment', 'Get-AzADSpCredential', 'Get-AzADUser', 'New-AzADAppCredential', 'New-AzADAppFederatedCredential', 'New-AzADApplication', 'New-AzADGroup', 'New-AzADGroupOwner', 'New-AzADServicePrincipal', 'New-AzADServicePrincipalAppRoleAssignment', 'New-AzADSpCredential', 'New-AzADUser', 'Remove-AzADAppCredential', 'Remove-AzADAppFederatedCredential', 'Remove-AzADApplication', 'Remove-AzADAppPermission', 'Remove-AzADGroup', 'Remove-AzADGroupMember', 'Remove-AzADGroupOwner', 'Remove-AzADServicePrincipal', 'Remove-AzADServicePrincipalAppRoleAssignment', 'Remove-AzADSpCredential', 'Remove-AzADUser', 'Update-AzADAppFederatedCredential', 'Update-AzADApplication', 'Update-AzADGroup', 'Update-AzADServicePrincipal', 'Update-AzADServicePrincipalAppRoleAssignment', 'Update-AzADUser'
AliasesToExport = 'Get-AzADServicePrincipalCredential', 'New-AzADServicePrincipalCredential', 'Remove-AzADServicePrincipalCredential', 'Set-AzADApplication', 'Set-AzADServicePrincipal', 'Set-AzADUser'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'MSGraph'
Expand Down
26 changes: 26 additions & 0 deletions src/Resources/MSGraph.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the ""License"");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an ""AS IS"" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - MSGraph")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
14 changes: 13 additions & 1 deletion src/Resources/MSGraph.Autorest/custom/New-AzADApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ function New-AzADApplication {
[System.String[]]
${PublicClientRedirectUri},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Int32]
${RequestedAccessTokenVersion},

[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
Expand All @@ -513,7 +518,6 @@ function New-AzADApplication {
# To construct, see NOTES section for REQUIREDRESOURCEACCESS properties and create a hash table.
${RequiredResourceAccess},


[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.String]
Expand Down Expand Up @@ -672,6 +676,14 @@ function New-AzADApplication {
$null = $PSBoundParameters.Remove('PublicClientRedirectUri')
}

if ($PSBoundParameters['RequestedAccessTokenVersion'] -and $PSBoundParameters['Api']) {
$PSBoundParameters['Api'].RequestedAccessTokenVersion = $PSBoundParameters['RequestedAccessTokenVersion']
}
elseif ($PSBoundParameters['RequestedAccessTokenVersion']) {
$PSBoundParameters['Api'] = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphApiApplication" -Property @{'RequestedAccessTokenVersion' = $PSBoundParameters['RequestedAccessTokenVersion'] }
}
$null = $PSBoundParameters.Remove('RequestedAccessTokenVersion')

if ($PSBoundParameters['StartDate']) {
$sd = $PSBoundParameters['StartDate']
$null = $PSBoundParameters.Remove('StartDate')
Expand Down
13 changes: 13 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/Update-AzADApplication.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ function Update-AzADApplication {
[System.String[]]
${PublicClientRedirectUri},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[System.Int32]
${RequestedAccessTokenVersion},

[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
Expand Down Expand Up @@ -549,6 +554,14 @@ function Update-AzADApplication {
$null = $PSBoundParameters.Remove('PublicClientRedirectUri')
}

if ($PSBoundParameters['RequestedAccessTokenVersion'] -and $PSBoundParameters['Api']) {
$PSBoundParameters['Api'].RequestedAccessTokenVersion = $PSBoundParameters['RequestedAccessTokenVersion']
}
elseif ($PSBoundParameters['RequestedAccessTokenVersion']) {
$PSBoundParameters['Api'] = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphApiApplication" -Property @{'RequestedAccessTokenVersion' = $PSBoundParameters['RequestedAccessTokenVersion'] }
}
$null = $PSBoundParameters.Remove('RequestedAccessTokenVersion')

Az.MSGraph.internal\Update-AzADApplication @PSBoundParameters
}
}
2 changes: 1 addition & 1 deletion src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.MSGraph
Module Guid: dd44abe1-c90f-434a-8c2d-e7927f212461
Module Guid: 9c1e9bcf-5175-4d03-99c7-a7f2f7040f46
Download Help Link: https://learn.microsoft.com/powershell/module/az.msgraph
Help Version: 1.0.0.0
Locale: en-US
Expand Down
49 changes: 32 additions & 17 deletions src/Resources/MSGraph.Autorest/docs/New-AzADApplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ New-AzADApplication -DisplayName <String> [-AddIn <IMicrosoftGraphAddIn[]>]
[-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrls <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-ReplyUrls <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
Expand All @@ -44,9 +44,9 @@ New-AzADApplication -DisplayName <String> -KeyCredentials <IMicrosoftGraphKeyCre
[-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrls <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-ReplyUrls <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
Expand All @@ -64,10 +64,10 @@ New-AzADApplication -CertValue <String> -DisplayName <String> [-AddIn <IMicrosof
[-IsFallbackPublicClient] [-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrls <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-StartDate <DateTime>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-ReplyUrls <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-StartDate <DateTime>] [-Tag <String[]>]
[-TokenEncryptionKeyId <String>] [-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```
Expand All @@ -84,9 +84,9 @@ New-AzADApplication -DisplayName <String> -PasswordCredentials <IMicrosoftGraphP
[-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrls <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-ReplyUrls <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
Expand All @@ -104,10 +104,10 @@ New-AzADApplication -DisplayName <String> [-AddIn <IMicrosoftGraphAddIn[]>]
[-IsFallbackPublicClient] [-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrls <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-StartDate <DateTime>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-ReplyUrls <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-StartDate <DateTime>] [-Tag <String[]>]
[-TokenEncryptionKeyId <String>] [-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```
Expand Down Expand Up @@ -588,6 +588,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -RequestedAccessTokenVersion
```yaml
Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -RequiredResourceAccess
Specifies the resources that the application needs to access.
This property also specifies the set of OAuth permission scopes and application roles that it needs for each of those resources.
Expand Down
33 changes: 24 additions & 9 deletions src/Resources/MSGraph.Autorest/docs/Update-AzADApplication.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Update-AzADApplication -ObjectId <String> [-AddIn <IMicrosoftGraphAddIn[]>]
[-IsFallbackPublicClient] [-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrl <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-ReplyUrl <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
Expand All @@ -44,9 +44,9 @@ Update-AzADApplication -ApplicationId <Guid> [-AddIn <IMicrosoftGraphAddIn[]>]
[-IsFallbackPublicClient] [-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrl <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-ReplyUrl <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
Expand All @@ -64,9 +64,9 @@ Update-AzADApplication -InputObject <IMicrosoftGraphApplication> [-AddIn <IMicro
[-IsFallbackPublicClient] [-LogoInputFile <String>] [-Note <String>] [-Oauth2RequirePostResponse]
[-OptionalClaim <IMicrosoftGraphOptionalClaims>]
[-ParentalControlSetting <IMicrosoftGraphParentalControlSettings>] [-PublicClientRedirectUri <String[]>]
[-ReplyUrl <String[]>] [-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>]
[-ServiceManagementReference <String>] [-SignInAudience <String>] [-SPARedirectUri <String[]>]
[-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-ReplyUrl <String[]>] [-RequestedAccessTokenVersion <Int32>]
[-RequiredResourceAccess <IMicrosoftGraphRequiredResourceAccess[]>] [-ServiceManagementReference <String>]
[-SignInAudience <String>] [-SPARedirectUri <String[]>] [-Tag <String[]>] [-TokenEncryptionKeyId <String>]
[-TokenIssuancePolicy <IMicrosoftGraphTokenIssuancePolicy[]>]
[-TokenLifetimePolicy <IMicrosoftGraphTokenLifetimePolicy[]>] [-Web <IMicrosoftGraphWebApplication>]
[-DefaultProfile <PSObject>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]
Expand Down Expand Up @@ -556,6 +556,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -RequestedAccessTokenVersion
```yaml
Type: System.Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -RequiredResourceAccess
Specifies the resources that the application needs to access.
This property also specifies the set of OAuth permission scopes and application roles that it needs for each of those resources.
Expand Down

0 comments on commit f071717

Please sign in to comment.