Skip to content

Commit 35939e2

Browse files
committed
Bugfixes
1 parent da51a52 commit 35939e2

File tree

4 files changed

+62
-53
lines changed

4 files changed

+62
-53
lines changed

SPFx/.vscode/launch.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"name": "Serve doclib command (Edge)",
2525
"type": "msedge",
2626
"request": "launch",
27-
"url": "https://mkvj.sharepoint.com/sites/mkvj?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
27+
"url": "https://{YOUR_TENANT}.sharepoint.com/sites/{YOUR_SITE}?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
2828
"webRoot": "${workspaceRoot}",
2929
"sourceMaps": true,
3030
"sourceMapPathOverrides": {
@@ -36,21 +36,21 @@
3636
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
3737
"runtimeArgs": [
3838
"--remote-debugging-port=9222",
39-
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
40-
//"-incognito"
39+
//"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
40+
"-inprivate"
4141
],
4242
"preLaunchTask": "serve-doc-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
4343
"postDebugTask": "terminate",
4444
"presentation": {
45-
"group": "remote",
45+
"group": "doclib-remote",
4646
"order": 1
4747
}
4848
},
4949
{
5050
"name": "Serve custom list command (Edge)",
5151
"type": "msedge",
5252
"request": "launch",
53-
"url": "https://mkvj.sharepoint.com/sites/mkvj?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
53+
"url": "https://{YOUR_TENANT}.sharepoint.com/sites/{YOUR_SITE}?loadSPFX=true&debugManifestsFile=https://localhost:4321/temp/manifests.js",
5454
"webRoot": "${workspaceRoot}",
5555
"sourceMaps": true,
5656
"sourceMapPathOverrides": {
@@ -62,13 +62,13 @@
6262
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
6363
"runtimeArgs": [
6464
"--remote-debugging-port=9222",
65-
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
66-
//"-incognito"
65+
//"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
66+
"-inprivate"
6767
],
6868
"preLaunchTask": "serve-list-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
6969
"postDebugTask": "terminate",
7070
"presentation": {
71-
"group": "remote",
71+
"group": "list-remote",
7272
"order": 1
7373
}
7474
},
@@ -104,14 +104,14 @@
104104
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
105105
"runtimeArgs": [
106106
"--remote-debugging-port=9222",
107-
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
108-
//"-incognito"
107+
//"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
108+
"-incognito"
109109
],
110110
"preLaunchTask": "serve-doc-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
111111
"postDebugTask": "terminate",
112112
"presentation": {
113-
"group": "remote",
114-
"order": 1
113+
"group": "doclib-remote",
114+
"order": 2
115115
}
116116
},
117117
{
@@ -130,14 +130,14 @@
130130
// Source: https://www.codeproject.com/Articles/1236613/Set-Which-Chrome-Profile-for-Visual-Studio-to-Use
131131
"runtimeArgs": [
132132
"--remote-debugging-port=9222",
133-
"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
134-
//"-incognito"
133+
//"--profile-directory='Profile 2'" // Change this to your preferred profile to open upon launching the browser
134+
"-incognito"
135135
],
136136
"preLaunchTask": "serve-list-command", // See also: https://code.visualstudio.com/Docs/editor/tasks
137137
"postDebugTask": "terminate",
138138
"presentation": {
139-
"group": "remote",
140-
"order": 1
139+
"group": "list-remote",
140+
"order": 2
141141
}
142142
}
143143
]

SPFx/gulp-tasks/update-settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ var UpdateSettings = {
118118
// Update settings to stage values from the appSettings.all.json file
119119
if (
120120
packageJson.solution.webApiPermissionRequests[0].resource !==
121-
inputJson.environment[targetEnv].AppResourceName
121+
inputJson.environments[targetEnv].AppResourceName
122122
) {
123123
packageJson.solution.webApiPermissionRequests[0].resource =
124-
inputJson.environment[targetEnv].AppResourceName;
124+
inputJson.environments[targetEnv].AppResourceName;
125125
packageJsonIsUpdated = true;
126126
}
127127

pipelines/production/azure-pipelines-production-build.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ trigger:
88
include:
99
- 'SPFx/*'
1010

11-
variables:
12-
packageName: enhanced-power-automate-trigger
13-
vmImageName: ubuntu-latest # ubuntu-latest | windows-latest | macOS-latest
14-
1511
pool:
16-
vmImageName: ubuntu-latest | windows-latest | macOS-latest
12+
vmImageName: ubuntu-latest # ubuntu-latest | windows-latest | macOS-latest
1713
demands:
1814
- npm
1915
- node.js
Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,65 @@
11
<#
22
.SYNOPSIS
3-
Script to create a self signed certificate.
3+
Script to create a self-signed certificate.
44
55
.DESCRIPTION
6-
This script allows you to create a self signed certificate and its private key information file.
6+
This script allows you to create a self-signed certificate and its private key information file.
77
The certificate can be used to authenticate identities, like Azure app registrations.
8-
The script creates the certificate in the PowerShell working directory.
98
The script also automatically removes the created certificate from the user's keystore.
109
1110
.PARAMETER certificateName <string> [required]
1211
The name of the certificate.
1312
1413
.PARAMETER certificatePwd <string> [required]
15-
The name password for the certificate encryption.
14+
The password used for certificate encryption.
1615
1716
.PARAMETER monthsValid <int> [required]
1817
The number of months before the certificate becomes invalid.
18+
19+
.PARAMETER folderPath <string> [required]
20+
The (relative) folder path the certificate should be created in.
1921
#>
2022

2123
<# ---------------- Program execution ---------------- #>
2224

2325
Function Create-SelfSignedCertificate (
24-
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][string]$certificateName,
25-
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][System.Security.SecureString]$certificatePwd,
26-
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][int]$monthsValid) {
27-
Try {
28-
$certificateName = "$($certificateName)"
29-
30-
Write-Host "Creating certificate..."
31-
$cert = New-SelfSignedCertificate -Subject "CN=$($certificateName)" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256 -NotAfter (Get-Date).AddMonths($monthsValid)
32-
Export-Certificate -Cert $cert -FilePath "../$($certificateName).cer" | Out-Null
33-
Write-Host "Successfully created the certificate!" -ForegroundColor Green
34-
35-
Write-Host "Creating private key for the certificate..."
36-
Export-PfxCertificate -Cert $cert -FilePath "../$($certificateName).pfx" -Password $certificatePwd | Out-Null
37-
Write-Host "Successfully created the private key!" -ForegroundColor Green
38-
39-
Write-Host "Removing created certificate from the user's personal keystore..."
40-
$keyStoreCertThumbPrint = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object { $_.Subject -Match $Name } | Select-Object Thumbprint
41-
Remove-Item -Path "Cert:\CurrentUser\My\$($keyStoreCertThumbPrint.Thumbprint)" -DeleteKey -ErrorAction SilentlyContinue | Out-Null
42-
Write-Host "Successfully removed the certificate from the personal keystore!" -ForegroundColor Green
43-
44-
Write-Host "`nDone." -ForegroundColor Green
45-
}
46-
Catch [Exception] {
47-
Write-Host "`nAn error occurred: $($_.Exception.Message)" -ForegroundColor Red
48-
throw $_.Exception
26+
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][string]$certificateName,
27+
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][string]$certificatePwd,
28+
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][int]$monthsValid,
29+
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][string]$folderPath) {
30+
Try {
31+
$certificateSecurePwd = ConvertTo-SecureString $certificatePwd -AsPlainText -Force
32+
33+
If ($folderPath.Substring($folderPath.Length - 1) -ne "/" -Or $folderPath.Substring($folderPath.Length - 1) -ne "\") {
34+
$folderPath = $folderPath + "/"
4935
}
36+
37+
$fullPath = $folderPath + $certificateName
38+
39+
Write-Host "`nCreating certificate..."
40+
$cert = New-SelfSignedCertificate -Subject "CN=$($certificateName)" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256 -NotAfter (Get-Date).AddMonths($monthsValid)
41+
Export-Certificate -Cert $cert -FilePath "$($fullPath).cer" | Out-Null
42+
43+
Write-Host "Creating private key for the certificate..."
44+
Export-PfxCertificate -Cert $cert -FilePath "$($fullPath).pfx" -Password $certificateSecurePwd | Out-Null
45+
46+
Write-Host "Removing created certificate from the user's personal keystore..."
47+
$keyStoreCertThumbPrint = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where-Object { $_.Subject -Match $Name } | Select-Object Thumbprint
48+
Remove-Item -Path "Cert:\CurrentUser\My\$($keyStoreCertThumbPrint.Thumbprint)" -DeleteKey -ErrorAction SilentlyContinue | Out-Null
49+
50+
Write-Host "`n------------------------------------------------------------------------" -ForegroundColor Magenta
51+
52+
Write-Host "`nSuccessfully created the self-signed certificate!" -ForegroundColor Green
53+
Write-Host "Certificate thumbnail : $($cert.Thumbprint)" -ForegroundColor Green
54+
Write-Host "Certificate password : $($certificatePwd)" -ForegroundColor Green
55+
Write-Host "Output folder : $($fullPath)" -ForegroundColor Green
56+
57+
Write-Host "`nDone." -ForegroundColor Magenta
58+
}
59+
Catch [Exception] {
60+
Write-Host "`nAn error occurred: $($_.Exception.Message)" -ForegroundColor Red
61+
throw $_.Exception
62+
}
5063
}
5164

52-
Export-ModuleMember -Function Create-SelfSignedCertificate
65+
Export-ModuleMember -Function Create-SelfSignedCertificate

0 commit comments

Comments
 (0)