Skip to content

Commit 1fe889b

Browse files
Modularization of Entra Powershell Module (#1165)
1 parent 64c014a commit 1fe889b

File tree

3,333 files changed

+246646
-60178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,333 files changed

+246646
-60178
lines changed

.azure-pipelines/1es-entra-powershell-ci-build.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ extends:
3232
name: MSSecurity-1ES-Build-Agents-Pool
3333
image: MSSecurity-1ES-Windows-2022
3434
os: windows
35+
credscan:
36+
suppressionsFile: $(Build.SourcesDirectory)\.config\CredScanSuppressions.json
37+
outputFormat: pre
38+
debugMode: false
39+
batchSize: 16
40+
psscriptanalyzer:
41+
break: false
42+
enabled: true
3543
stages:
3644
- stage: build
3745
jobs:
@@ -42,15 +50,15 @@ extends:
4250
- template: .azure-pipelines/common-templates/install-tools.yml@self
4351
- template: .azure-pipelines/common-templates/security-pre-checks.yml@self
4452

45-
- template: .azure-pipelines/generation-templates/generate_adapter-migrate-1es.yml@self
53+
- template: .azure-pipelines/generation-templates/generate_adapter-1es.yml@self
4654
parameters:
4755
Sign: ${{ parameters.Sign }}
4856

4957
- ${{ if and(eq(parameters.Pack, true), eq(parameters.Sign, true)) }}:
5058
- template: .azure-pipelines/common-templates/esrp/codesign-nuget-migrate.yml@self
5159
parameters:
5260
FolderPath: "$(Build.ArtifactStagingDirectory)"
53-
Pattern: "Microsoft.Graph.Entra.*.nupkg"
61+
Pattern: "Microsoft.Entra.*.nupkg"
5462
- task: 1ES.PublishBuildArtifacts@1
5563
displayName: Publish Module Artifacts
5664
inputs:
@@ -60,7 +68,7 @@ extends:
6068
displayName: Publish NuGet to preview feed
6169
inputs:
6270
useDotNetTask: false
63-
packagesToPush: $(Build.ArtifactStagingDirectory)/**/Microsoft.Graph.Entra.*.nupkg
71+
packagesToPush: $(Build.ArtifactStagingDirectory)/**/Microsoft.Entra.*.nupkg
6472
packageParentPath: '$(Build.ArtifactStagingDirectory)'
6573
publishVstsFeed: $(PROJECT_NAME)/$(PREVIEW_FEED_NAME)
6674
nuGetFeedType: internal

.azure-pipelines/1es-entra-powershell-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extends:
5858
displayName: Publish Nuget package
5959
inputs:
6060
useDotNetTask: false
61-
packagesToPush: '$(System.ArtifactsDirectory)/drop/Microsoft.Graph.Entra*.nupkg'
61+
packagesToPush: '$(System.ArtifactsDirectory)/drop/Microsoft.Entra*.nupkg'
6262
packageParentPath: '$(System.ArtifactsDirectory)'
6363
nuGetFeedType: external
6464
publishFeedCredentials: EntraPowerShell_PSGallery

.azure-pipelines/ci-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- template: ./common-templates/esrp/codesign-nuget.yml
4242
parameters:
4343
FolderPath: "$(Build.ArtifactStagingDirectory)"
44-
Pattern: "Microsoft.Graph.Entra.*.nupkg"
44+
Pattern: "Microsoft.Entra.*.nupkg"
4545

4646
- task: PublishBuildArtifacts@1
4747
displayName: Publish Module Artifacts
@@ -54,7 +54,7 @@ jobs:
5454
displayName: Publish NuGet to preview feed
5555
inputs:
5656
command: push
57-
packagesToPush: $(Build.ArtifactStagingDirectory)/**/Microsoft.Graph.Entra.*.nupkg
57+
packagesToPush: $(Build.ArtifactStagingDirectory)/**/Microsoft.Entra.*.nupkg
5858
publishVstsFeed: $(PROJECT_NAME)/$(PREVIEW_FEED_NAME)
5959
allowPackageConflicts: true
6060

.azure-pipelines/entra-powershell-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ stages:
4040
inputs:
4141
targetType: inline
4242
script: |
43-
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path $(Build.ArtifactStagingDirectory)/modules/Microsoft.Graph.Entra -Verbose
44-
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path $(Build.ArtifactStagingDirectory)/modules/Microsoft.Graph.Entra.Beta -Verbose
43+
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path $(Build.ArtifactStagingDirectory)/modules/Microsoft.Entra -Verbose
44+
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path $(Build.ArtifactStagingDirectory)/modules/Microsoft.Entra.Beta -Verbose
4545
pwsh: false
4646
dependsOn: Release_Approval
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
# https://aka.ms/yaml
4+
5+
parameters:
6+
- name: Sign
7+
type: boolean
8+
default: false
9+
- name: Integration
10+
type: boolean
11+
default: false
12+
13+
steps:
14+
- task: powershell@2
15+
displayName: 'Show current PowerShell version information'
16+
inputs:
17+
targetType: inline
18+
script: 'echo $PSVersionTable'
19+
pwsh: true
20+
- task: powershell@2
21+
displayName: 'Set maximum function count'
22+
inputs:
23+
targetType: inline
24+
script: '$MaximumFunctionCount=32768'
25+
pwsh: true
26+
- task: powershell@2
27+
displayName: 'Install Dependencies Entra'
28+
inputs:
29+
targetType: inline
30+
script: |
31+
./build/Install-Dependencies.ps1 -ModuleName Entra -Verbose
32+
pwsh: true
33+
- task: powershell@2
34+
displayName: 'Install PlatyPS'
35+
inputs:
36+
targetType: inline
37+
script: Install-Module PlatyPS -scope currentuser -Force
38+
pwsh: true
39+
# - task: powershell@2
40+
# displayName: 'Create Module Help Files Entra'
41+
# inputs:
42+
# targetType: inline
43+
# script: |
44+
# Import-Module PlatyPS
45+
# . ./build/common-functions.ps1
46+
# Create-ModuleHelp -Module Entra
47+
# pwsh: true
48+
- task: powershell@2
49+
displayName: '[Modularization ] Build Entra'
50+
inputs:
51+
targetType: inline
52+
script: |
53+
./build/Create-EntraModule.ps1 -Module Entra -Verbose
54+
./build/Create-EntraModule.ps1 -Module Entra -Root -Verbose
55+
pwsh: true
56+
- ${{ if eq(parameters.Sign, true) }}:
57+
- template: ../common-templates/esrp/codesign-migrate.yml
58+
parameters:
59+
FolderPath: "bin"
60+
Pattern: "*.psm1, *.psd1, *.format.ps1xml, *.ps1"
61+
- task: PowerShell@2
62+
displayName: "Validate Authenticode Signature"
63+
inputs:
64+
targetType: "inline"
65+
pwsh: true
66+
script: ./build/ValidateAuthenticodeSignature.ps1
67+
- task: powershell@2
68+
displayName: 'Create Module Files Entra'
69+
inputs:
70+
targetType: inline
71+
script: |
72+
. ./build/common-functions.ps1
73+
Create-ModuleFolder
74+
pwsh: true
75+
- task: 1ES.PublishBuildArtifacts@1
76+
displayName: 'Publish Module Files EntraBeta'
77+
inputs:
78+
PathtoPublish: 'bin'
79+
ArtifactName: 'Module Files'
80+
- task: powershell@2
81+
displayName: 'Register Local Gallery'
82+
inputs:
83+
targetType: inline
84+
script: |
85+
. ./build/common-functions.ps1
86+
Register-LocalGallery -Path $(Build.ArtifactStagingDirectory)
87+
pwsh: true
88+
- task: powershell@2
89+
displayName: 'Publish to Local Gallery Entra'
90+
inputs:
91+
targetType: inline
92+
script: ./build/Publish-LocalCompatModule.ps1 -Install
93+
pwsh: true
94+
- task: 1ES.PublishBuildArtifacts@1
95+
displayName: 'Publish Module Nuget File Entra'
96+
inputs:
97+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
98+
ArtifactName: 'Module Nuget'
99+
- task: powershell@2
100+
displayName: 'Remove Build Folders'
101+
inputs:
102+
targetType: inline
103+
script: |
104+
. ./build/common-functions.ps1
105+
Remove-BuildDirectories
106+
pwsh: true
107+
- task: powershell@2
108+
displayName: 'Install Dependencies EntraBeta'
109+
inputs:
110+
targetType: inline
111+
script: |
112+
./build/Install-Dependencies.ps1 -ModuleName EntraBeta -Verbose
113+
pwsh: true
114+
# - task: powershell@2
115+
# displayName: 'Create Module Help Files EntraBeta'
116+
# inputs:
117+
# targetType: inline
118+
# script: |
119+
# Import-Module PlatyPS
120+
# . ./build/common-functions.ps1
121+
# Create-ModuleHelp -Module EntraBeta
122+
# pwsh: true
123+
- task: powershell@2
124+
displayName: '[Modularization ] Build EntraBeta'
125+
inputs:
126+
targetType: inline
127+
script: |
128+
./build/Create-EntraModule.ps1 -Module EntraBeta -Verbose
129+
./build/Create-EntraModule.ps1 -Module EntraBeta -Root -Verbose
130+
pwsh: true
131+
- ${{ if eq(parameters.Sign, true) }}:
132+
- template: ../common-templates/esrp/codesign-migrate.yml
133+
parameters:
134+
FolderPath: "bin"
135+
Pattern: "*.psm1, *.psd1, *.format.ps1xml, *.ps1"
136+
- task: PowerShell@2
137+
displayName: "Validate Authenticode Signature"
138+
inputs:
139+
targetType: "inline"
140+
pwsh: true
141+
script: ./build/ValidateAuthenticodeSignature.ps1
142+
- task: powershell@2
143+
displayName: 'Create Module Files EntraBeta'
144+
inputs:
145+
targetType: inline
146+
script: |
147+
. ./build/common-functions.ps1
148+
Create-ModuleFolder
149+
pwsh: true
150+
- task: 1ES.PublishBuildArtifacts@1
151+
displayName: 'Publish Module Files EntraBeta'
152+
inputs:
153+
PathtoPublish: 'bin'
154+
ArtifactName: 'Module Files'
155+
- task: powershell@2
156+
displayName: 'Publish to Local Gallery EntraBeta'
157+
inputs:
158+
targetType: inline
159+
script: ./build/Publish-LocalCompatModule.ps1 -Install
160+
pwsh: true
161+
- task: 1ES.PublishBuildArtifacts@1
162+
displayName: 'Publish Module Nuget File EntraBeta'
163+
inputs:
164+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
165+
ArtifactName: 'Module Nuget'
166+
- task: powershell@2
167+
displayName: 'Remove Build Folders'
168+
inputs:
169+
targetType: inline
170+
script: |
171+
. ./build/common-functions.ps1
172+
Remove-BuildDirectories
173+
pwsh: true
174+
- task: powershell@2
175+
displayName: 'Install Pester'
176+
inputs:
177+
targetType: inline
178+
script: Install-Module Pester -scope currentuser -SkipPublisherCheck -Force
179+
pwsh: true
180+
- task: powershell@2
181+
displayName: 'Run tests Entra'
182+
inputs:
183+
targetType: inline
184+
pwsh: true
185+
script: |
186+
cd test/Entra
187+
Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml
188+
- task: PublishTestResults@2
189+
inputs:
190+
testResultsFormat: NUnit
191+
testResultsFiles: "./test/results/pester-test-results-ad.xml"
192+
failTaskOnFailedTests: true
193+
- task: powershell@2
194+
displayName: 'Run tests Entra Beta'
195+
inputs:
196+
targetType: inline
197+
pwsh: true
198+
script: |
199+
cd test/EntraBeta
200+
Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml
201+
- task: PublishTestResults@2
202+
inputs:
203+
testResultsFormat: NUnit
204+
testResultsFiles: "./test/results/pester-test-results-ad.xml"
205+
failTaskOnFailedTests: true
206+
- ${{ if eq(parameters.Integration, true) }}:
207+
- task: powershell@2
208+
displayName: 'Run Entra integration tests'
209+
inputs:
210+
targetType: inline
211+
pwsh: true
212+
script: |
213+
cd test/module/Integration/Entra
214+
Invoke-Pester -OutputFile "./test/results/pester-test-results-preview.xml" -OutputFormat NUnitXml
215+
- task: PublishTestResults@2
216+
inputs:
217+
testResultsFormat: NUnit
218+
testResultsFiles: "./test/results/pester-test-results-preview.xml"
219+
failTaskOnFailedTests: true
220+
- task: powershell@2
221+
displayName: 'Run EntraBeta integration tests'
222+
inputs:
223+
targetType: inline
224+
pwsh: true
225+
script: |
226+
cd test/module/Integration/EntraBeta
227+
Invoke-Pester -OutputFile "./test/results/pester-test-results-preview.xml" -OutputFormat NUnitXml
228+
- task: PublishTestResults@2
229+
inputs:
230+
testResultsFormat: NUnit
231+
testResultsFiles: "./test/results/pester-test-results-preview.xml"
232+
failTaskOnFailedTests: true
233+
- task: powershell@2
234+
displayName: 'Remove Local Gallery'
235+
inputs:
236+
targetType: inline
237+
script: |
238+
. ./build/common-functions.ps1
239+
Unregister-LocalGallery
240+
pwsh: true
241+
- task: PSScriptAnalyzer@1
242+
displayName: 'Run PSScriptAnalyzer'
243+
inputs:
244+
Path: '$(Build.SourcesDirectory)'
245+
Settings: required
246+
IgnorePattern: .gdn
247+
Recurse: true

0 commit comments

Comments
 (0)