Skip to content

Commit d303ad0

Browse files
authored
Lock module GUID (#1358)
* Lock meta-module GUID. * Lock GUID of service modules. * Add basic Pester tests.
1 parent 7b83f50 commit d303ad0

File tree

13 files changed

+273
-55
lines changed

13 files changed

+273
-55
lines changed

config/ModuleMetadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"guid": "fceec1eb-c2e8-4b2b-a120-0fab3f0d7b47",
23
"authors": "Microsoft",
34
"owners": "Microsoft",
45
"description": "Microsoft Graph PowerShell module",

src/Applications/Applications/test/Applications.Tests.ps1

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
Describe "Microsoft.Graph.Applications Module" {
5+
BeforeAll {
6+
$ModuleName = "Microsoft.Graph.Applications"
7+
$ModulePath = Join-Path $PSScriptRoot "..\$ModuleName.psd1"
8+
$PSModuleInfo = Get-Module $ModuleName
9+
}
10+
11+
Context "On module import" {
12+
It "Should have exported commands" {
13+
$PSModuleInfo | Should -Not -Be $null
14+
$PSModuleInfo.ExportedCommands.Count | Should -Not -Be 0
15+
}
16+
17+
It 'Should be compatible with PS core and desktop' {
18+
$PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop")
19+
}
20+
21+
It 'Should point to script module' {
22+
$PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1"
23+
}
24+
25+
It 'Should have a definition' {
26+
$PSModuleInfo.Definition | Should -Not -BeNullOrEmpty
27+
}
28+
29+
It 'Should lock GUID' {
30+
$PSModuleInfo.Guid.Guid | Should -Be "467f54f2-44a8-4993-8e75-b96c3e443098"
31+
}
32+
33+
It "Module import should not write to streams when debug preference is not set" {
34+
$ps = [powershell]::Create()
35+
$ps.AddScript("Import-Module $ModulePath -ErrorAction SilentlyContinue").Invoke()
36+
37+
$ps.Streams.Information.Count | Should -Be 0
38+
$ps.Streams.Debug.Count | Should -Be 0
39+
$ps.Streams.Error.Count | Should -Be 0
40+
$ps.Streams.Verbose.Count | Should -Be 0
41+
$ps.Streams.Warning.Count | Should -Be 0
42+
$ps.Streams.Progress.Count | Should -Be 0
43+
44+
$ps.Dispose()
45+
}
46+
47+
It "Module import should write to streams when debug preference is set" {
48+
$ps = [powershell]::Create()
49+
$ps.AddScript("`$DebugPreference = 'Inquire'; Import-Module $ModulePath -ErrorAction SilentlyContinue").Invoke()
50+
51+
$ps.Streams.Information.Count | Should -Be 0
52+
$ps.Streams.Debug.Count | Should -Be 0
53+
$ps.Streams.Error.Count | Should -Be 0
54+
$ps.Streams.Verbose.Count | Should -Be 0
55+
$ps.Streams.Warning.Count | Should -Be 0
56+
$ps.Streams.Progress.Count | Should -Be 0
57+
58+
$ps.Dispose()
59+
}
60+
}
61+
}

src/Authentication/Authentication/test/Microsoft.Graph.Authentication.Tests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,9 @@ Describe "Microsoft.Graph.Authentication module" {
6767
$PSModuleInfo.ExportedAliases.Keys | Should -BeIn $ExpectedAliases
6868
} | Should -Not -Throw
6969
}
70+
71+
It 'Should lock GUID' {
72+
$PSModuleInfo.Guid.Guid | Should -Be "883916f2-9184-46ee-b1f8-b6a2fb784cee"
73+
}
7074
}
7175
}

src/Authentication/Authentication/test/loadEnv.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) {
2323
}
2424
$env = @{}
2525
if (Test-Path -Path $envFilePath) {
26-
# Load dummy auth configuration.
26+
# Load dummy auth configuration. This is used to run Pester tests.
2727
$env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json -AsHashTable
2828
[Microsoft.Graph.PowerShell.Authentication.GraphSession]::Instance.AuthContext = New-Object Microsoft.Graph.PowerShell.Authentication.AuthContext -Property @{
2929
ClientId = $env.ClientId
3030
TenantId = $env.TenantId
31+
AuthType = [Microsoft.Graph.PowerShell.Authentication.AuthenticationType]::UserProvidedAccessToken
32+
AuthProviderType = [Microsoft.Graph.PowerShell.Authentication.AuthProviderType]::UserProvidedToken
3133
}
3234
}

src/Graph/Graph/Microsoft.Graph.nuspec

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,56 @@
22
<package>
33
<metadata>
44
<id>Microsoft.Graph</id>
5-
<version>0.9.2</version>
5+
<version>1.10.0</version>
66
<authors>Microsoft</authors>
77
<owners>Microsoft</owners>
88
<licenseUrl>https://aka.ms/devservicesagreement</licenseUrl>
99
<projectUrl>https://github.com/microsoftgraph/msgraph-sdk-powershell</projectUrl>
10-
<iconUrl>https://raw.githubusercontent.com/microsoftgraph/g-raph/master/g-raph.png</iconUrl>
10+
<iconUrl>https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/master/documentation/images/graph_color256.png</iconUrl>
1111
<requireLicenseAcceptance>true</requireLicenseAcceptance>
1212
<description>Microsoft Graph PowerShell module</description>
1313
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
14-
<tags>MicrosoftGraph;Microsoft;Office365;Graph;PowerShell;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;Intune;SDK;</tags>
14+
<tags>MicrosoftGraph Microsoft Office365 Graph PowerShell Outlook OneDrive AzureAD SharePoint Intune AzureAutomationNotSupported</tags>
1515
<dependencies>
16-
<dependency id="Microsoft.Graph.Authentication" version="0.9.1" />
16+
<dependency id="Microsoft.Graph.Authentication" version="1.10.0" />
17+
<dependency id="Microsoft.Graph.Calendar" version="1.10.0" />
18+
<dependency id="Microsoft.Graph.DeviceManagement.Functions" version="1.10.0" />
19+
<dependency id="Microsoft.Graph.Identity.Governance" version="1.10.0" />
20+
<dependency id="Microsoft.Graph.ChangeNotifications" version="1.10.0" />
21+
<dependency id="Microsoft.Graph.Users.Actions" version="1.10.0" />
22+
<dependency id="Microsoft.Graph.SchemaExtensions" version="1.10.0" />
23+
<dependency id="Microsoft.Graph.DeviceManagement.Enrolment" version="1.10.0" />
24+
<dependency id="Microsoft.Graph.Bookings" version="1.10.0" />
25+
<dependency id="Microsoft.Graph.Devices.CorporateManagement" version="1.10.0" />
26+
<dependency id="Microsoft.Graph.Devices.ServiceAnnouncement" version="1.10.0" />
27+
<dependency id="Microsoft.Graph.Users.Functions" version="1.10.0" />
28+
<dependency id="Microsoft.Graph.Education" version="1.10.0" />
29+
<dependency id="Microsoft.Graph.Notes" version="1.10.0" />
30+
<dependency id="Microsoft.Graph.DirectoryObjects" version="1.10.0" />
31+
<dependency id="Microsoft.Graph.Applications" version="1.10.0" />
32+
<dependency id="Microsoft.Graph.People" version="1.10.0" />
33+
<dependency id="Microsoft.Graph.Groups" version="1.10.0" />
34+
<dependency id="Microsoft.Graph.CrossDeviceExperiences" version="1.10.0" />
35+
<dependency id="Microsoft.Graph.Reports" version="1.10.0" />
36+
<dependency id="Microsoft.Graph.Users" version="1.10.0" />
37+
<dependency id="Microsoft.Graph.Search" version="1.10.0" />
38+
<dependency id="Microsoft.Graph.Teams" version="1.10.0" />
39+
<dependency id="Microsoft.Graph.Identity.SignIns" version="1.10.0" />
40+
<dependency id="Microsoft.Graph.Files" version="1.10.0" />
41+
<dependency id="Microsoft.Graph.WindowsUpdates" version="1.10.0" />
42+
<dependency id="Microsoft.Graph.Compliance" version="1.10.0" />
43+
<dependency id="Microsoft.Graph.DeviceManagement" version="1.10.0" />
44+
<dependency id="Microsoft.Graph.DeviceManagement.Actions" version="1.10.0" />
45+
<dependency id="Microsoft.Graph.Planner" version="1.10.0" />
46+
<dependency id="Microsoft.Graph.Identity.DirectoryManagement" version="1.10.0" />
47+
<dependency id="Microsoft.Graph.PersonalContacts" version="1.10.0" />
48+
<dependency id="Microsoft.Graph.Financials" version="1.10.0" />
49+
<dependency id="Microsoft.Graph.DeviceManagement.Administration" version="1.10.0" />
50+
<dependency id="Microsoft.Graph.Mail" version="1.10.0" />
51+
<dependency id="Microsoft.Graph.Sites" version="1.10.0" />
52+
<dependency id="Microsoft.Graph.Security" version="1.10.0" />
53+
<dependency id="Microsoft.Graph.CloudCommunications" version="1.10.0" />
54+
<dependency id="Microsoft.Graph.Devices.CloudPrint" version="1.10.0" />
1755
</dependencies>
1856
<releaseNotes>See https://aka.ms/GraphPowerShell-Release.</releaseNotes>
1957
</metadata>

src/Graph/Graph/Microsoft.Graph.psd1

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft
55
#
6-
# Generated on: 11/18/2020
6+
# Generated on: 6/29/2022
77
#
88

99
@{
@@ -12,13 +12,13 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.1.0'
15+
ModuleVersion = '1.10.0'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'
1919

2020
# ID used to uniquely identify this module
21-
GUID = 'ba3e9757-d74f-45ea-9d0f-0287d0d45b9a'
21+
GUID = 'fceec1eb-c2e8-4b2b-a120-0fab3f0d7b47'
2222

2323
# Author of this module
2424
Author = 'Microsoft'
@@ -51,7 +51,45 @@ DotNetFrameworkVersion = '4.7.2'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '0.9.1'; })
54+
RequiredModules = @(@{ModuleName = 'Microsoft.Graph.Authentication'; ModuleVersion = '1.10.0'; },
55+
@{ModuleName = 'Microsoft.Graph.Calendar'; RequiredVersion = '1.10.0'; },
56+
@{ModuleName = 'Microsoft.Graph.DeviceManagement.Functions'; RequiredVersion = '1.10.0'; },
57+
@{ModuleName = 'Microsoft.Graph.Identity.Governance'; RequiredVersion = '1.10.0'; },
58+
@{ModuleName = 'Microsoft.Graph.ChangeNotifications'; RequiredVersion = '1.10.0'; },
59+
@{ModuleName = 'Microsoft.Graph.Users.Actions'; RequiredVersion = '1.10.0'; },
60+
@{ModuleName = 'Microsoft.Graph.SchemaExtensions'; RequiredVersion = '1.10.0'; },
61+
@{ModuleName = 'Microsoft.Graph.DeviceManagement.Enrolment'; RequiredVersion = '1.10.0'; },
62+
@{ModuleName = 'Microsoft.Graph.Bookings'; RequiredVersion = '1.10.0'; },
63+
@{ModuleName = 'Microsoft.Graph.Devices.CorporateManagement'; RequiredVersion = '1.10.0'; },
64+
@{ModuleName = 'Microsoft.Graph.Devices.ServiceAnnouncement'; RequiredVersion = '1.10.0'; },
65+
@{ModuleName = 'Microsoft.Graph.Users.Functions'; RequiredVersion = '1.10.0'; },
66+
@{ModuleName = 'Microsoft.Graph.Education'; RequiredVersion = '1.10.0'; },
67+
@{ModuleName = 'Microsoft.Graph.Notes'; RequiredVersion = '1.10.0'; },
68+
@{ModuleName = 'Microsoft.Graph.DirectoryObjects'; RequiredVersion = '1.10.0'; },
69+
@{ModuleName = 'Microsoft.Graph.Applications'; RequiredVersion = '1.10.0'; },
70+
@{ModuleName = 'Microsoft.Graph.People'; RequiredVersion = '1.10.0'; },
71+
@{ModuleName = 'Microsoft.Graph.Groups'; RequiredVersion = '1.10.0'; },
72+
@{ModuleName = 'Microsoft.Graph.CrossDeviceExperiences'; RequiredVersion = '1.10.0'; },
73+
@{ModuleName = 'Microsoft.Graph.Reports'; RequiredVersion = '1.10.0'; },
74+
@{ModuleName = 'Microsoft.Graph.Users'; RequiredVersion = '1.10.0'; },
75+
@{ModuleName = 'Microsoft.Graph.Search'; RequiredVersion = '1.10.0'; },
76+
@{ModuleName = 'Microsoft.Graph.Teams'; RequiredVersion = '1.10.0'; },
77+
@{ModuleName = 'Microsoft.Graph.Identity.SignIns'; RequiredVersion = '1.10.0'; },
78+
@{ModuleName = 'Microsoft.Graph.Files'; RequiredVersion = '1.10.0'; },
79+
@{ModuleName = 'Microsoft.Graph.WindowsUpdates'; RequiredVersion = '1.10.0'; },
80+
@{ModuleName = 'Microsoft.Graph.Compliance'; RequiredVersion = '1.10.0'; },
81+
@{ModuleName = 'Microsoft.Graph.DeviceManagement'; RequiredVersion = '1.10.0'; },
82+
@{ModuleName = 'Microsoft.Graph.DeviceManagement.Actions'; RequiredVersion = '1.10.0'; },
83+
@{ModuleName = 'Microsoft.Graph.Planner'; RequiredVersion = '1.10.0'; },
84+
@{ModuleName = 'Microsoft.Graph.Identity.DirectoryManagement'; RequiredVersion = '1.10.0'; },
85+
@{ModuleName = 'Microsoft.Graph.PersonalContacts'; RequiredVersion = '1.10.0'; },
86+
@{ModuleName = 'Microsoft.Graph.Financials'; RequiredVersion = '1.10.0'; },
87+
@{ModuleName = 'Microsoft.Graph.DeviceManagement.Administration'; RequiredVersion = '1.10.0'; },
88+
@{ModuleName = 'Microsoft.Graph.Mail'; RequiredVersion = '1.10.0'; },
89+
@{ModuleName = 'Microsoft.Graph.Sites'; RequiredVersion = '1.10.0'; },
90+
@{ModuleName = 'Microsoft.Graph.Security'; RequiredVersion = '1.10.0'; },
91+
@{ModuleName = 'Microsoft.Graph.CloudCommunications'; RequiredVersion = '1.10.0'; },
92+
@{ModuleName = 'Microsoft.Graph.Devices.CloudPrint'; RequiredVersion = '1.10.0'; })
5593

5694
# Assemblies that must be loaded prior to importing this module
5795
# RequiredAssemblies = @()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
5+
Describe "Microsoft.Graph.Identity.SignIns module" {
6+
BeforeAll {
7+
$ModuleName = "Microsoft.Graph.Identity.SignIns"
8+
$PSModuleInfo = Get-Module $ModuleName
9+
}
10+
11+
Context "On module import" {
12+
It 'Should be compatible with PS core and desktop' {
13+
$PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop")
14+
}
15+
16+
It 'Should point to script module' {
17+
$PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1"
18+
}
19+
20+
It 'Should have a definition' {
21+
$PSModuleInfo.Definition | Should -Not -BeNullOrEmpty
22+
}
23+
24+
It 'Should lock GUID' {
25+
$PSModuleInfo.Guid.Guid | Should -Be "60f889fa-f873-43ad-b7d3-b7fc1273a44f"
26+
}
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
5+
Describe "Microsoft.Graph.Reports module" {
6+
BeforeAll {
7+
$ModuleName = "Microsoft.Graph.Reports"
8+
$PSModuleInfo = Get-Module $ModuleName
9+
}
10+
11+
Context "On module import" {
12+
It 'Should be compatible with PS core and desktop' {
13+
$PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop")
14+
}
15+
16+
It 'Should point to script module' {
17+
$PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1"
18+
}
19+
20+
It 'Should have a definition' {
21+
$PSModuleInfo.Definition | Should -Not -BeNullOrEmpty
22+
}
23+
24+
It 'Should lock GUID' {
25+
$PSModuleInfo.Guid.Guid | Should -Be "0bfc88b7-a8ad-471a-8c86-5f0aa3c84217"
26+
}
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
5+
Describe "Microsoft.Graph.Sites module" {
6+
BeforeAll {
7+
$ModuleName = "Microsoft.Graph.Sites"
8+
$PSModuleInfo = Get-Module $ModuleName
9+
}
10+
11+
Context "On module import" {
12+
It 'Should be compatible with PS core and desktop' {
13+
$PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop")
14+
}
15+
16+
It 'Should point to script module' {
17+
$PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1"
18+
}
19+
20+
It 'Should have a definition' {
21+
$PSModuleInfo.Definition | Should -Not -BeNullOrEmpty
22+
}
23+
24+
It 'Should lock GUID' {
25+
$PSModuleInfo.Guid.Guid | Should -Be "7ae8c25b-f1dd-466d-a022-b5489f919c70"
26+
}
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
# ------------------------------------------------------------------------------
4+
5+
Describe "Microsoft.Graph.Users module" {
6+
BeforeAll {
7+
$ModuleName = "Microsoft.Graph.Users"
8+
$PSModuleInfo = Get-Module $ModuleName
9+
}
10+
11+
Context "On module import" {
12+
It 'Should be compatible with PS core and desktop' {
13+
$PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop")
14+
}
15+
16+
It 'Should point to script module' {
17+
$PSModuleInfo.Path | Should -BeLikeExactly "*$ModuleName.psm1"
18+
}
19+
20+
It 'Should have a definition' {
21+
$PSModuleInfo.Definition | Should -Not -BeNullOrEmpty
22+
}
23+
24+
It 'Should lock GUID' {
25+
$PSModuleInfo.Guid.Guid | Should -Be "71150504-37a3-48c6-82c7-7a00a12168db"
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)