Skip to content

Commit e1fbadd

Browse files
authored
Merge pull request #47 from AzureAD/preview
Promote Preview
2 parents c2abb95 + c3c1361 commit e1fbadd

31 files changed

+1179
-442
lines changed

.vscode/extensions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"ms-vscode.powershell"
8+
]
9+
}

.vscode/launch.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99
"type": "PowerShell",
1010
"request": "launch",
1111
"preLaunchTask": "",
12-
"script": "${workspaceRoot}/Launch-PSModule.ps1",
12+
"script": "${workspaceRoot}/build/Launch-PSModule.ps1",
1313
"cwd": "${workspaceRoot}",
1414
"args":[
15+
"-ModuleManifestPath './src/*.psd1'",
1516
"-NoNewWindow"
1617
]
1718
},
1819
{
1920
"name": "PowerShell Launch Module and Connect",
2021
"type": "PowerShell",
2122
"request": "launch",
22-
"script": "${workspaceRoot}/Launch-PSModule.ps1",
23+
"script": "${workspaceRoot}/build/Launch-PSModule.ps1",
2324
"cwd": "${workspaceRoot}",
2425
"args": [
26+
"-ModuleManifestPath './src/*.psd1'",
2527
"-PostImportScriptBlock { New-MsalClientApplication -ClientId c62a9fcb-53bf-446e-8063-ea6e2bfcc023 -RedirectUri 'http://localhost' | Enable-MsalTokenCacheOnDisk -PassThru | Connect-AADAssessment }",
2628
"-NoNewWindow"
2729
]
@@ -30,9 +32,10 @@
3032
"name": "PowerShell Launch Module, Connect, and Current Function",
3133
"type": "PowerShell",
3234
"request": "launch",
33-
"script": "${workspaceRoot}/Launch-PSModule.ps1",
35+
"script": "${workspaceRoot}/build/Launch-PSModule.ps1",
3436
"cwd": "${workspaceRoot}",
3537
"args": [
38+
"-ModuleManifestPath './src/*.psd1'",
3639
"-PostImportScriptBlock { New-MsalClientApplication -ClientId c62a9fcb-53bf-446e-8063-ea6e2bfcc023 -RedirectUri 'http://localhost' | Enable-MsalTokenCacheOnDisk -PassThru | Connect-AADAssessment; ${fileBasenameNoExtension} }",
3740
"-NoNewWindow"
3841
]
@@ -41,9 +44,10 @@
4144
"name": "PowerShell Launch Module and Connect in New External Console",
4245
"type": "PowerShell",
4346
"request": "launch",
44-
"script": "${workspaceRoot}/Launch-PSModule.ps1",
47+
"script": "${workspaceRoot}/build/Launch-PSModule.ps1",
4548
"cwd": "${workspaceRoot}",
4649
"args": [
50+
"-ModuleManifestPath './src/*.psd1'",
4751
"-PostImportScriptBlock { New-MsalClientApplication -ClientId c62a9fcb-53bf-446e-8063-ea6e2bfcc023 -RedirectUri 'http://localhost' | Enable-MsalTokenCacheOnDisk -PassThru | Connect-AADAssessment }",
4852
"-PowerShellPaths 'powershell'",
4953
"-NoNewWindow:$false"
@@ -54,9 +58,10 @@
5458
"type": "PowerShell",
5559
"request": "launch",
5660
"preLaunchTask": "",
57-
"script": "${workspaceRoot}/Launch-PSModule.ps1",
61+
"script": "${workspaceRoot}/build/Launch-PSModule.ps1",
5862
"cwd": "${workspaceRoot}",
5963
"args": [
64+
"-ModuleManifestPath './src/*.psd1'",
6065
"-PowerShellPaths 'pwsh','powershell'",
6166
"-NoNewWindow:$false"
6267
]
@@ -75,4 +80,4 @@
7580
"runspaceId": 1
7681
}
7782
]
78-
}
83+
}

.vscode/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// PowerShell Code Formatting
3+
"powershell.codeFormatting.addWhitespaceAroundPipe": true,
4+
"powershell.codeFormatting.alignPropertyValuePairs": true,
5+
"powershell.codeFormatting.autoCorrectAliases": true,
6+
"powershell.codeFormatting.newLineAfterCloseBrace": true,
7+
"powershell.codeFormatting.newLineAfterOpenBrace": true,
8+
"powershell.codeFormatting.openBraceOnSameLine": true,
9+
"powershell.codeFormatting.pipelineIndentationStyle": "NoIndentation",
10+
"powershell.codeFormatting.preset": "Stroustrup",
11+
"powershell.codeFormatting.trimWhitespaceAroundPipe": true,
12+
//"powershell.codeFormatting.useConstantStrings": true,
13+
"powershell.codeFormatting.useCorrectCasing": true,
14+
"powershell.codeFormatting.whitespaceAfterSeparator": true,
15+
"powershell.codeFormatting.whitespaceAroundOperator": true,
16+
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
17+
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
18+
"powershell.codeFormatting.whitespaceBetweenParameters": true,
19+
"powershell.codeFormatting.whitespaceInsideBrace": true
20+
21+
// Editor Settings
22+
//"editor.formatOnSave": true,
23+
//"editor.formatOnSaveMode": "modificationsIfAvailable"
24+
}
32 KB
Binary file not shown.
-30.4 KB
Binary file not shown.

assets/AzureADAssessment.pbit

65.5 KB
Binary file not shown.
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
param
2-
(
3-
# Module to Launch
4-
[Parameter(Mandatory = $false)]
5-
[string] $ModuleManifestPath = ".\src\*.psd1",
6-
# ScriptBlock to Execute After Module Import
7-
[Parameter(Mandatory = $false)]
8-
[scriptblock] $PostImportScriptBlock,
9-
# Paths to PowerShell Executables
10-
[Parameter(Mandatory = $false)]
11-
[string[]] $PowerShellPaths = @(
12-
'pwsh'
13-
'powershell'
14-
),
15-
# Import Module into the same session
16-
[Parameter(Mandatory = $false)]
17-
[switch] $NoNewWindow #= $true
18-
)
19-
20-
if ($NoNewWindow) {
21-
Import-Module $ModuleManifestPath -PassThru -Force
22-
if ($PostImportScriptBlock) { Invoke-Command -ScriptBlock $PostImportScriptBlock -NoNewScope }
23-
}
24-
else {
25-
[scriptblock] $ScriptBlock = {
26-
param ([string]$ModulePath, [scriptblock]$PostImportScriptBlock)
27-
## Force WindowsPowerShell to load correct version of built-in modules when launched from PowerShell 6+
28-
if ($PSVersionTable.PSEdition -eq 'Desktop') { Import-Module 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Utility', 'CimCmdlets' -MaximumVersion 5.9.9.9 }
29-
Import-Module $ModulePath -PassThru -ArgumentList @{
30-
'ai.instrumentationKey' = 'f7c43a96-9493-41e3-ad62-4320f5835ce2'
31-
}
32-
Invoke-Command -ScriptBlock $PostImportScriptBlock -NoNewScope
33-
}
34-
$strScriptBlock = 'Invoke-Command -ScriptBlock {{ {0} }} -ArgumentList {1}, {{ {2} }}' -f $ScriptBlock, $ModuleManifestPath, $PostImportScriptBlock
35-
#$strScriptBlock = 'Import-Module {0} -PassThru' -f $ModuleManifestPath
36-
37-
foreach ($Path in $PowerShellPaths) {
38-
Start-Process $Path -ArgumentList ('-NoExit', '-NoProfile', '-EncodedCommand', [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($strScriptBlock)))
39-
}
40-
}
1+
param
2+
(
3+
# Module to Launch
4+
[Parameter(Mandatory = $false)]
5+
[string] $ModuleManifestPath = ".\src\*.psd1",
6+
# ScriptBlock to Execute After Module Import
7+
[Parameter(Mandatory = $false)]
8+
[scriptblock] $PostImportScriptBlock,
9+
# Paths to PowerShell Executables
10+
[Parameter(Mandatory = $false)]
11+
[string[]] $PowerShellPaths = @(
12+
'pwsh'
13+
'powershell'
14+
),
15+
# Import Module into the same session
16+
[Parameter(Mandatory = $false)]
17+
[switch] $NoNewWindow #= $true
18+
)
19+
20+
if ($NoNewWindow) {
21+
Import-Module $ModuleManifestPath -PassThru -Force
22+
if ($PostImportScriptBlock) { Invoke-Command -ScriptBlock $PostImportScriptBlock -NoNewScope }
23+
}
24+
else {
25+
[scriptblock] $ScriptBlock = {
26+
param ([string]$ModulePath, [scriptblock]$PostImportScriptBlock)
27+
## Force WindowsPowerShell to load correct version of built-in modules when launched from PowerShell 6+
28+
if ($PSVersionTable.PSEdition -eq 'Desktop') { Import-Module 'Microsoft.PowerShell.Management', 'Microsoft.PowerShell.Utility', 'CimCmdlets' -MaximumVersion 5.9.9.9 }
29+
Import-Module $ModulePath -PassThru -ArgumentList @{
30+
'ai.instrumentationKey' = 'f7c43a96-9493-41e3-ad62-4320f5835ce2'
31+
}
32+
Invoke-Command -ScriptBlock $PostImportScriptBlock -NoNewScope
33+
}
34+
$strScriptBlock = 'Invoke-Command -ScriptBlock {{ {0} }} -ArgumentList {1}, {{ {2} }}' -f $ScriptBlock, $ModuleManifestPath, $PostImportScriptBlock
35+
#$strScriptBlock = 'Import-Module {0} -PassThru' -f $ModuleManifestPath
36+
37+
foreach ($Path in $PowerShellPaths) {
38+
Start-Process $Path -ArgumentList ('-NoExit', '-NoProfile', '-EncodedCommand', [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($strScriptBlock)))
39+
}
40+
}

build/Update-PSModuleManifest.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ if ($Prerelease) { $paramUpdateModuleManifest['Prerelease'] = $Prerelease }
2828

2929
## Read Module Manifest
3030
$ModuleManifest = Import-PowerShellDataFile $ModuleManifestFileInfo.FullName
31-
$paramUpdateModuleManifest['NestedModules'] = $ModuleManifest.NestedModules
31+
if ($ModuleManifest.NestedModules) { $paramUpdateModuleManifest['NestedModules'] = $ModuleManifest.NestedModules }
32+
$paramUpdateModuleManifest['FunctionsToExport'] = $ModuleManifest.FunctionsToExport
3233
$paramUpdateModuleManifest['CmdletsToExport'] = $ModuleManifest.CmdletsToExport
3334
$paramUpdateModuleManifest['AliasesToExport'] = $ModuleManifest.AliasesToExport
3435
[System.IO.DirectoryInfo] $ModuleOutputDirectoryInfo = $ModuleManifestFileInfo.Directory

build/azure-pipelines/azure-pipelines-cd.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ stages:
5959
Path: '$(Pipeline.Workspace)/CI/$(artifactModule)'
6060
Settings: 'required'
6161
Recurse: true
62-
62+
- task: ManifestGeneratorTask@0
63+
inputs:
64+
BuildDropPath: '$(Pipeline.Workspace)/CI/$(artifactModule)'
65+
- task: PublishPipelineArtifact@1
66+
displayName: 'Publish PowerShell Module Artifact'
67+
inputs:
68+
targetPath: '$(Pipeline.Workspace)/CI/$(artifactModule)'
69+
artifact: '$(artifactModule)'
70+
publishLocation: 'pipeline'
71+
6372
- job: Sign
6473
dependsOn:
6574
- Prepare
@@ -75,6 +84,7 @@ stages:
7584
parameters:
7685
moduleName: '$(moduleName)'
7786
pipelineId: 'CI'
87+
EsrpCodeSigningServiceName: 'ESRP - MSFT Identity - Community Projects'
7888

7989
- stage: Package
8090
displayName: 'Standalone Package'

build/azure-pipelines/template-psmodule-build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ parameters:
2323
- name: artifactOutput
2424
type: string
2525
default: 'PSModule'
26+
- name: GenerateManifest
27+
type: boolean
28+
default: false
2629

2730
steps:
2831
- task: CopyFiles@2
@@ -81,6 +84,12 @@ steps:
8184
arguments: '-ModuleManifestPath "$(Pipeline.Workspace)/${{ parameters.artifactOutput }}/${{ coalesce(parameters.moduleRename,parameters.moduleName) }}/${{ coalesce(parameters.moduleRename,parameters.moduleName) }}.psd1" -Guid "${{ parameters.moduleGuid }}" -ModuleVersion "${{ parameters.moduleVersion }}" -Prerelease "${{ parameters.prereleaseTag }}" -SkipRequiredAssemblies'
8285
pwsh: true
8386

87+
- ${{ if parameters.GenerateManifest }}:
88+
- task: ManifestGeneratorTask@0
89+
displayName: 'Generate Software Bill of Materials (SBOM)'
90+
inputs:
91+
BuildDropPath: '$(Pipeline.Workspace)/${{ parameters.artifactOutput }}'
92+
8493
- task: PublishPipelineArtifact@1
8594
displayName: 'Publish PowerShell Module Artifact'
8695
inputs:

0 commit comments

Comments
 (0)