From 3fc6b82d63b923d834e26348180499cdede7e61c Mon Sep 17 00:00:00 2001 From: Isaiah Williams Date: Thu, 9 Jan 2020 23:24:31 -0600 Subject: [PATCH] Token feature update (#255) --- docs/help/Connect-PartnerCenter.md | 17 +++++++++++-- docs/help/New-PartnerAccessToken.md | 24 ++++++++++++++----- .../Commands/NewPartnerAccessToken.cs | 6 ++++- src/PowerShell/Commands/PartnerPSCmdlet.cs | 3 +-- src/PowerShell/PartnerCenter.psd1 | 4 ++-- src/PowerShell/PartnerCenter.psm1 | 2 +- src/PowerShell/PowerShell.csproj | 2 +- 7 files changed, 43 insertions(+), 15 deletions(-) diff --git a/docs/help/Connect-PartnerCenter.md b/docs/help/Connect-PartnerCenter.md index 25ca998..9a2983b 100644 --- a/docs/help/Connect-PartnerCenter.md +++ b/docs/help/Connect-PartnerCenter.md @@ -28,8 +28,9 @@ Connect-PartnerCenter -AccessToken [-Environment ] [-T ### RefreshToken ```powershell -Connect-PartnerCenter -ApplicationId [-Credential ] [-Environment ] - -RefreshToken [-Tenant ] [-WhatIf] [-Confirm] [] +Connect-PartnerCenter -ApplicationId [-CertificateThumbprint ] [-Credential ] + [-Environment ] -RefreshToken [-Tenant ] [-WhatIf] [-Confirm] + [] ``` ### ServicePrincipalCertificate @@ -121,6 +122,18 @@ Accept wildcard characters: False ### -CertificateThumbprint Certificate Hash (Thumbprint) +```yaml +Type: String +Parameter Sets: RefreshToken +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ```yaml Type: String Parameter Sets: ServicePrincipalCertificate diff --git a/docs/help/New-PartnerAccessToken.md b/docs/help/New-PartnerAccessToken.md index 517bea5..a4986f6 100644 --- a/docs/help/New-PartnerAccessToken.md +++ b/docs/help/New-PartnerAccessToken.md @@ -22,9 +22,9 @@ New-PartnerAccessToken -AccessToken -ApplicationId [-Credentia ### RefreshToken ```powershell -New-PartnerAccessToken [-ApplicationId ] [-Credential ] [-Environment ] - [-Module ] -RefreshToken -Scopes [-ServicePrincipal] [-Tenant ] - [] +New-PartnerAccessToken [-ApplicationId ] [-CertificateThumbprint ] [-Credential ] + [-Environment ] [-Module ] -RefreshToken -Scopes + [-ServicePrincipal] [-Tenant ] [] ``` ### ServicePrincipal @@ -47,8 +47,8 @@ New-PartnerAccessToken -ApplicationId [-Environment ] ### ByModule ```powershell -New-PartnerAccessToken [-Environment ] -Module -Scopes - [-Tenant ] [-UseAuthorizationCode] [] +New-PartnerAccessToken [-Environment ] -Module [-Tenant ] + [-UseAuthorizationCode] [] ``` ## DESCRIPTION @@ -122,6 +122,18 @@ Accept wildcard characters: False ### -CertificateThumbprint Certificate Hash (Thumbprint) +```yaml +Type: String +Parameter Sets: RefreshToken +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ```yaml Type: String Parameter Sets: ServicePrincipalCertificate @@ -226,7 +238,7 @@ Scopes requested to access a protected API. ```yaml Type: String[] -Parameter Sets: (All) +Parameter Sets: AccessToken, RefreshToken, ServicePrincipal, ServicePrincipalCertificate, User Aliases: Required: True diff --git a/src/PowerShell/Commands/NewPartnerAccessToken.cs b/src/PowerShell/Commands/NewPartnerAccessToken.cs index 6957db3..2ce6411 100644 --- a/src/PowerShell/Commands/NewPartnerAccessToken.cs +++ b/src/PowerShell/Commands/NewPartnerAccessToken.cs @@ -115,7 +115,11 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands /// /// Gets or sets the scopes used for authentication. /// - [Parameter(HelpMessage = "Scopes requested to access a protected API.", Mandatory = true)] + [Parameter(HelpMessage = "Scopes requested to access a protected API.", Mandatory = true, ParameterSetName = AccessTokenParameterSet)] + [Parameter(HelpMessage = "Scopes requested to access a protected API.", Mandatory = true, ParameterSetName = RefreshTokenParameterSet)] + [Parameter(HelpMessage = "Scopes requested to access a protected API.", Mandatory = true, ParameterSetName = ServicePrincipalParameterSet)] + [Parameter(HelpMessage = "Scopes requested to access a protected API.", Mandatory = true, ParameterSetName = ServicePrincipalCertificateParameterSet)] + [Parameter(HelpMessage = "Scopes requested to access a protected API.", Mandatory = true, ParameterSetName = UserParameterSet)] public string[] Scopes { get; set; } /// diff --git a/src/PowerShell/Commands/PartnerPSCmdlet.cs b/src/PowerShell/Commands/PartnerPSCmdlet.cs index c981173..93cc910 100644 --- a/src/PowerShell/Commands/PartnerPSCmdlet.cs +++ b/src/PowerShell/Commands/PartnerPSCmdlet.cs @@ -194,7 +194,7 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands if (!string.IsNullOrEmpty(PartnerSession.Instance?.Context?.Account?.Identifier)) { - qosEvent.UserId = GenerateSha256HashString(PartnerSession.Instance.Context.Account.Identifier); + qosEvent.UserId = GenerateSha256HashString(PartnerSession.Instance.Context.Account.Identifier)?.Replace("-", string.Empty)?.ToLowerInvariant(); } if (MyInvocation != null && MyInvocation.BoundParameters != null && MyInvocation.BoundParameters.Keys != null) @@ -271,7 +271,6 @@ namespace Microsoft.Store.PartnerCenter.PowerShell.Commands base.StopProcessing(); } - /// /// Terminate the command and report an error. /// diff --git a/src/PowerShell/PartnerCenter.psd1 b/src/PowerShell/PartnerCenter.psd1 index d88648e..70f7356 100644 --- a/src/PowerShell/PartnerCenter.psd1 +++ b/src/PowerShell/PartnerCenter.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 01/08/2010 +# Generated on: 01/10/2010 # @{ @@ -11,7 +11,7 @@ RootModule = 'PartnerCenter.psm1' # Version number of this module. - ModuleVersion = '3.0.4' + ModuleVersion = '3.0.5' # Supported PSEditions CompatiblePSEditions = 'Core', 'Desktop' diff --git a/src/PowerShell/PartnerCenter.psm1 b/src/PowerShell/PartnerCenter.psm1 index d471a9f..07e0424 100644 --- a/src/PowerShell/PartnerCenter.psm1 +++ b/src/PowerShell/PartnerCenter.psm1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 01/08/2020 +# Generated on: 01/10/2020 # $PSDefaultParameterValues.Clear() diff --git a/src/PowerShell/PowerShell.csproj b/src/PowerShell/PowerShell.csproj index f2b5216..99ebb63 100644 --- a/src/PowerShell/PowerShell.csproj +++ b/src/PowerShell/PowerShell.csproj @@ -18,7 +18,7 @@ false $(RepoArtifacts)$(Configuration)\ $(OutputPath) - 3.0.4 + 3.0.5 latest MIT