From a2bd7cd90097077916574da387acb536f2c6ff85 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 27 Jan 2021 16:43:11 -0800 Subject: [PATCH 1/3] Fix broken error flattening logic. --- .../Authentication/Cmdlets/ConnectMgGraph.cs | 2 +- .../Authentication/Cmdlets/InvokeMgGraphRequest.cs | 2 +- .../Microsoft.Graph.Authentication.csproj | 2 +- .../Microsoft.Graph.Authentication.nuspec | 2 +- .../Microsoft.Graph.Authentication.psd1 | 4 ++-- .../Authentication/test/Connect-MgGraph.Tests.ps1 | 14 ++++++++++++++ ...n.Tests.ps1 => Invoke-MgGraphRequest.Tests.ps1} | 0 7 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1 rename src/Authentication/Authentication/test/{Authentication.Tests.ps1 => Invoke-MgGraphRequest.Tests.ps1} (100%) diff --git a/src/Authentication/Authentication/Cmdlets/ConnectMgGraph.cs b/src/Authentication/Authentication/Cmdlets/ConnectMgGraph.cs index 9c16aed41f..df8a87742a 100644 --- a/src/Authentication/Authentication/Cmdlets/ConnectMgGraph.cs +++ b/src/Authentication/Authentication/Cmdlets/ConnectMgGraph.cs @@ -125,7 +125,7 @@ protected override void ProcessRecord() foreach (var innerException in aggregateException.Flatten().InnerExceptions) { var errorRecords = innerException.Data; - if (errorRecords.Count < 1) + if (errorRecords.Count > 1) { foreach (DictionaryEntry dictionaryEntry in errorRecords) { diff --git a/src/Authentication/Authentication/Cmdlets/InvokeMgGraphRequest.cs b/src/Authentication/Authentication/Cmdlets/InvokeMgGraphRequest.cs index 8ef56c42cb..b70922af3e 100644 --- a/src/Authentication/Authentication/Cmdlets/InvokeMgGraphRequest.cs +++ b/src/Authentication/Authentication/Cmdlets/InvokeMgGraphRequest.cs @@ -1205,7 +1205,7 @@ protected override void ProcessRecord() foreach (var innerException in aggregateException.Flatten().InnerExceptions) { var errorRecords = innerException.Data; - if (errorRecords.Count < 1) + if (errorRecords.Count > 1) { foreach (DictionaryEntry dictionaryEntry in errorRecords) { diff --git a/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj b/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj index 06915d200f..98f467d4de 100644 --- a/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj +++ b/src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj @@ -1,6 +1,6 @@ - 1.2.0 + 1.3.0 7.1 netstandard2.0 Library diff --git a/src/Authentication/Authentication/Microsoft.Graph.Authentication.nuspec b/src/Authentication/Authentication/Microsoft.Graph.Authentication.nuspec index b1247787e6..4f486b6645 100644 --- a/src/Authentication/Authentication/Microsoft.Graph.Authentication.nuspec +++ b/src/Authentication/Authentication/Microsoft.Graph.Authentication.nuspec @@ -1,7 +1,7 @@ - 1.2.0 + 1.3.0 Microsoft.Graph.Authentication Microsoft Graph PowerShell authentication module Microsoft diff --git a/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1 b/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1 index 58b92e0a4f..c8d0d559d4 100644 --- a/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1 +++ b/src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft # -# Generated on: 23-Jan-21 +# Generated on: 1/27/2021 # @{ @@ -12,7 +12,7 @@ RootModule = './Microsoft.Graph.Authentication.psm1' # Version number of this module. -ModuleVersion = '1.2.0' +ModuleVersion = '1.3.0' # Supported PSEditions CompatiblePSEditions = 'Core', 'Desktop' diff --git a/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1 b/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1 new file mode 100644 index 0000000000..14c366d1d2 --- /dev/null +++ b/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1 @@ -0,0 +1,14 @@ +BeforeAll { + $ModuleName = "Microsoft.Graph.Authentication" + $ModulePath = Join-Path $PSScriptRoot "..\$ModuleName.psd1" + Import-Module $ModulePath -Force +} +Describe 'Connect-MgGraph In Delegated Mode' { + It 'ShouldThrowExceptionWhenInvalidTenantIdIsSpecified' { + { Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -Scopes 'User.Read.All' -ErrorAction Stop } | Should -Throw -ExpectedMessage "*Tenant 'thisdomaindoesnotexist.com' not found*" + } + + It 'ShouldThrowExceptionWhenInvalidScopeIsSpecified' { + { Connect-MgGraph -Scopes 'User.Read.XYZ' -ErrorAction Stop } | Should -Throw -ExpectedMessage "*The scope 'User.Read.XYZ offline_access profile openid' does not exist*" + } +} \ No newline at end of file diff --git a/src/Authentication/Authentication/test/Authentication.Tests.ps1 b/src/Authentication/Authentication/test/Invoke-MgGraphRequest.Tests.ps1 similarity index 100% rename from src/Authentication/Authentication/test/Authentication.Tests.ps1 rename to src/Authentication/Authentication/test/Invoke-MgGraphRequest.Tests.ps1 From b90cc065bc2826be137d1d4ab8d4caf8d2a84a7c Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 27 Jan 2021 19:40:25 -0800 Subject: [PATCH 2/3] Lock autorest-core version to 3.0.6306 --- tools/GenerateModules.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/GenerateModules.ps1 b/tools/GenerateModules.ps1 index 8f2871bd6e..fd6dab8ad7 100644 --- a/tools/GenerateModules.ps1 +++ b/tools/GenerateModules.ps1 @@ -127,7 +127,7 @@ $ModulesToGenerate | ForEach-Object -ThrottleLimit $ModulesToGenerate.Count -Par try { # Generate PowerShell modules. - & autorest --module-version:$ModuleVersion --service-name:$ModuleName $ModuleLevelReadMePath --verbose + & autorest --module-version:$ModuleVersion --service-name:$ModuleName $ModuleLevelReadMePath --version:"3.0.6306" --verbose if ($LASTEXITCODE) { Write-Error "Failed to generate '$ModuleName' module." } From 87f0d53971b8eae2a4d5764f7e7c46068cff5c64 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Wed, 27 Jan 2021 19:43:15 -0800 Subject: [PATCH 3/3] Bump version of all modules to 1.3.0 --- src/Financials/Financials/readme.md | 2 +- src/Notes/Notes/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Financials/Financials/readme.md b/src/Financials/Financials/readme.md index 19805f6101..07ad6fb52c 100644 --- a/src/Financials/Financials/readme.md +++ b/src/Financials/Financials/readme.md @@ -57,6 +57,6 @@ directive: ### Versioning ``` yaml -module-version: 1.2.0 +module-version: 1.3.0 release-notes: See https://aka.ms/GraphPowerShell-Release. ``` diff --git a/src/Notes/Notes/readme.md b/src/Notes/Notes/readme.md index 34f6d1e0db..9857b7b6b4 100644 --- a/src/Notes/Notes/readme.md +++ b/src/Notes/Notes/readme.md @@ -44,6 +44,6 @@ directive: ### Versioning ``` yaml -module-version: 1.2.0 +module-version: 1.3.0 release-notes: See https://aka.ms/GraphPowerShell-Release. ```