From 87dac226a645bcc4ab235745537bcfcf3cab6538 Mon Sep 17 00:00:00 2001 From: JoyerJin <116236375+JoyerJin@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:20:07 +0800 Subject: [PATCH] add RequestedAccessTokenVersion parameter in cmdlets New/Update-AzADApplication --- src/Resources/MSGraph.Autorest/.gitignore | 2 + .../MSGraph.Autorest/Az.MSGraph.psd1 | 4 +- .../Properties/AssemblyInfo.cs | 26 ++++++++++ .../custom/New-AzADApplication.ps1 | 14 +++++- .../custom/Update-AzADApplication.ps1 | 13 +++++ .../MSGraph.Autorest/docs/Az.MSGraph.md | 2 +- .../docs/New-AzADApplication.md | 49 ++++++++++++------- .../docs/Update-AzADApplication.md | 33 +++++++++---- 8 files changed, 113 insertions(+), 30 deletions(-) create mode 100644 src/Resources/MSGraph.Autorest/Properties/AssemblyInfo.cs diff --git a/src/Resources/MSGraph.Autorest/.gitignore b/src/Resources/MSGraph.Autorest/.gitignore index 3c3d57339c8b..ccbe8d018341 100644 --- a/src/Resources/MSGraph.Autorest/.gitignore +++ b/src/Resources/MSGraph.Autorest/.gitignore @@ -8,7 +8,9 @@ tools custom/*.psm1 custom/autogen-model-cmdlets test/*-TestResults.xml +license.txt /*.ps1 +/*.psd1 /*.ps1xml /*.psm1 /*.snk diff --git a/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 b/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 index 049f6a5a71c8..f3cf48a7ba8e 100644 --- a/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 +++ b/src/Resources/MSGraph.Autorest/Az.MSGraph.psd1 @@ -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' diff --git a/src/Resources/MSGraph.Autorest/Properties/AssemblyInfo.cs b/src/Resources/MSGraph.Autorest/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..d33617ff0b78 --- /dev/null +++ b/src/Resources/MSGraph.Autorest/Properties/AssemblyInfo.cs @@ -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)] \ No newline at end of file diff --git a/src/Resources/MSGraph.Autorest/custom/New-AzADApplication.ps1 b/src/Resources/MSGraph.Autorest/custom/New-AzADApplication.ps1 index f1c9ed9925b8..3d47880ce0db 100644 --- a/src/Resources/MSGraph.Autorest/custom/New-AzADApplication.ps1 +++ b/src/Resources/MSGraph.Autorest/custom/New-AzADApplication.ps1 @@ -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')] @@ -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] @@ -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') diff --git a/src/Resources/MSGraph.Autorest/custom/Update-AzADApplication.ps1 b/src/Resources/MSGraph.Autorest/custom/Update-AzADApplication.ps1 index f55f9081fb39..dd6e4fbc1dc2 100644 --- a/src/Resources/MSGraph.Autorest/custom/Update-AzADApplication.ps1 +++ b/src/Resources/MSGraph.Autorest/custom/Update-AzADApplication.ps1 @@ -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')] @@ -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 } } diff --git a/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md b/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md index 74ae1de74e80..6932eac91b63 100644 --- a/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md +++ b/src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md @@ -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 diff --git a/src/Resources/MSGraph.Autorest/docs/New-AzADApplication.md b/src/Resources/MSGraph.Autorest/docs/New-AzADApplication.md index ff8ebf288d5a..50070755b21f 100644 --- a/src/Resources/MSGraph.Autorest/docs/New-AzADApplication.md +++ b/src/Resources/MSGraph.Autorest/docs/New-AzADApplication.md @@ -24,9 +24,9 @@ New-AzADApplication -DisplayName [-AddIn ] [-LogoInputFile ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrls ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-Tag ] [-TokenEncryptionKeyId ] + [-ReplyUrls ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-Tag ] [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] @@ -44,9 +44,9 @@ New-AzADApplication -DisplayName -KeyCredentials ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrls ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-Tag ] [-TokenEncryptionKeyId ] + [-ReplyUrls ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-Tag ] [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] @@ -64,10 +64,10 @@ New-AzADApplication -CertValue -DisplayName [-AddIn ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrls ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-StartDate ] [-Tag ] [-TokenEncryptionKeyId ] - [-TokenIssuancePolicy ] + [-ReplyUrls ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-StartDate ] [-Tag ] + [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] ``` @@ -84,9 +84,9 @@ New-AzADApplication -DisplayName -PasswordCredentials ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrls ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-Tag ] [-TokenEncryptionKeyId ] + [-ReplyUrls ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-Tag ] [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] @@ -104,10 +104,10 @@ New-AzADApplication -DisplayName [-AddIn ] [-IsFallbackPublicClient] [-LogoInputFile ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrls ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-StartDate ] [-Tag ] [-TokenEncryptionKeyId ] - [-TokenIssuancePolicy ] + [-ReplyUrls ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-StartDate ] [-Tag ] + [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] ``` @@ -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. diff --git a/src/Resources/MSGraph.Autorest/docs/Update-AzADApplication.md b/src/Resources/MSGraph.Autorest/docs/Update-AzADApplication.md index 9e70331ce841..fbb12af3cfc8 100644 --- a/src/Resources/MSGraph.Autorest/docs/Update-AzADApplication.md +++ b/src/Resources/MSGraph.Autorest/docs/Update-AzADApplication.md @@ -24,9 +24,9 @@ Update-AzADApplication -ObjectId [-AddIn ] [-IsFallbackPublicClient] [-LogoInputFile ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrl ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-Tag ] [-TokenEncryptionKeyId ] + [-ReplyUrl ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-Tag ] [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] @@ -44,9 +44,9 @@ Update-AzADApplication -ApplicationId [-AddIn ] [-IsFallbackPublicClient] [-LogoInputFile ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrl ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-Tag ] [-TokenEncryptionKeyId ] + [-ReplyUrl ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-Tag ] [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] @@ -64,9 +64,9 @@ Update-AzADApplication -InputObject [-AddIn ] [-Note ] [-Oauth2RequirePostResponse] [-OptionalClaim ] [-ParentalControlSetting ] [-PublicClientRedirectUri ] - [-ReplyUrl ] [-RequiredResourceAccess ] - [-ServiceManagementReference ] [-SignInAudience ] [-SPARedirectUri ] - [-Tag ] [-TokenEncryptionKeyId ] + [-ReplyUrl ] [-RequestedAccessTokenVersion ] + [-RequiredResourceAccess ] [-ServiceManagementReference ] + [-SignInAudience ] [-SPARedirectUri ] [-Tag ] [-TokenEncryptionKeyId ] [-TokenIssuancePolicy ] [-TokenLifetimePolicy ] [-Web ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] @@ -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.