The aim of this script is to prepare all the needed components and generate a CI/CD flow for either GitHub or Azure DevOps, depending on what the user passed to the script.
The script should have the following steps
- Generate a self-signed certificate and save the pfx- and cer-files and raw base64 of the cert
if the script will be in PowerShell we may use the below script as a starting point, it generates the .pfx files and gets the base64 encoded cert string to txt file
$password = ConvertTo-SecureString -String "some-safe-password" -Force -AsPlainText
$cert = New-SelfSignedCertificate -NotBefore $(Get-Date).AddDays(-1) -NotAfter $(Get-Date).AddYears(1) -FriendlyName "CI-CD-Certificate" -CertStoreLocation cert:\CurrentUser\My -Subject "CN=CICDCertificate" -KeyAlgorithm RSA -KeyLength 2048 -KeyExportPolicy Exportable
$cert | Export-Certificate -Type cer -FilePath "$PWD/CI-CD-Certificate.cer" -Force
$cert | Export-PfxCertificate -FilePath "$PWD/CI-CD-Certificate.pfx" -Password $password
$cert | Remove-Item
$pfxBytes = Get-Content "selfSignedCertificate.pfx" -AsByteStream -Raw
[System.Convert]::ToBase64String($pfxBytes) | Out-File "selfSignedCertificate.txt"
- Create the application registration, upload the certificate and grant it admin consent
we may use the following command for that, it will return the appId which we need
m365 aad app add --name 'My CI/CD Application' --apisApplication 'https://microsoft.sharepoint-df.com/Sites.FullControl.All' --certificateFile ./CI-CD-Certificate.cer --certificateDisplayName 'CICD Certificate' --grantAdminConsent
- create either a GitHub workflow or Azure DevOps pipeline
we may use the spfx project github workflow add command or spfx project azuredevops pipeline add command for that. (the second one is not done yet so we should wait with this script until its ready)
| Docs |
|
| Author |
me |
| Description |
setup a CI/CD pipeline using GitHub Workflows or Azure DevOps pipelines for your SPFx solution |
| Keywords |
deployment GitHub Azure DevOps Pipeline |
Additional info
the spfx project azuredevops pipeline add command is not done yet so we should wait with this script until it's ready #5763
The aim of this script is to prepare all the needed components and generate a CI/CD flow for either GitHub or Azure DevOps, depending on what the user passed to the script.
The script should have the following steps
if the script will be in PowerShell we may use the below script as a starting point, it generates the .pfx files and gets the base64 encoded cert string to txt file
we may use the following command for that, it will return the appId which we need
we may use the
spfx project github workflow addcommand orspfx project azuredevops pipeline addcommand for that. (the second one is not done yet so we should wait with this script until its ready)deploymentGitHubAzure DevOpsPipelineAdditional info
the
spfx project azuredevops pipeline addcommand is not done yet so we should wait with this script until it's ready #5763