зеркало из https://github.com/Azure/ALZ-Bicep.git
Add installation of ALZ Powershell module for policy scripts (#679)
* Add installation of ALZ Powershell module for policy scripts * Update query to add logging and adjust workflow for MC * Update accelerator doc for version * Update .github/scripts/Invoke-PolicyToBicep-China.ps1 Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com> * Update .github/scripts/Invoke-PolicyToBicep.ps1 Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com> --------- Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com>
This commit is contained in:
Родитель
ef8a90ccd4
Коммит
1c6ba005dd
|
@ -13,8 +13,6 @@ param (
|
|||
[string]
|
||||
$rootPath = "./infra-as-code/bicep/modules/policy",
|
||||
[string]
|
||||
$alzToolsPath = "$PWD/../Enterprise-Scale/src/Alz.Tools",
|
||||
[string]
|
||||
$definitionsRoot = "definitions",
|
||||
[string]
|
||||
$lineEnding = "unix",
|
||||
|
@ -43,8 +41,15 @@ param (
|
|||
)
|
||||
|
||||
# This script relies on a custom set of classes and functions
|
||||
# defined within the Alz.Tools PowerShell module.
|
||||
Import-Module $alzToolsPath -ErrorAction Stop
|
||||
# defined within the [ALZ-PowerShell-Module](https://github.com/Azure/Alz-powershell-module).
|
||||
if (-not (Get-Module -ListAvailable -Name ALZ)) {
|
||||
# Module doesn't exist, so install it
|
||||
Write-Information "====> ALZ module isn't already installed. Installing..." -InformationAction Continue
|
||||
Install-Module -Name ALZ -Force -Scope CurrentUser -ErrorAction Stop
|
||||
Write-Information "====> ALZ module now installed." -InformationAction Continue
|
||||
} else {
|
||||
Write-Information "====> ALZ module is already installed." -InformationAction Continue
|
||||
}
|
||||
|
||||
# Line Endings function to be used in three functions below
|
||||
function Update-FileLineEndingType {
|
||||
|
|
|
@ -38,6 +38,17 @@ param (
|
|||
$assignmentsTxtFileName = "_policyAssignmentsBicepInput.txt"
|
||||
)
|
||||
|
||||
# This script relies on a custom set of classes and functions
|
||||
# defined within the [ALZ-PowerShell-Module](https://github.com/Azure/Alz-powershell-module).
|
||||
if (-not (Get-Module -ListAvailable -Name ALZ)) {
|
||||
# Module doesn't exist, so install it
|
||||
Write-Information "====> ALZ module isn't already installed. Installing..." -InformationAction Continue
|
||||
Install-Module -Name ALZ -Force -Scope CurrentUser -ErrorAction Stop
|
||||
Write-Information "====> ALZ module now installed." -InformationAction Continue
|
||||
} else {
|
||||
Write-Information "====> ALZ module is already installed." -InformationAction Continue
|
||||
}
|
||||
|
||||
# Line Endings function to be used in three functions below
|
||||
function Update-FileLineEndingType {
|
||||
[CmdletBinding(SupportsShouldProcess)]
|
||||
|
|
|
@ -68,14 +68,18 @@ jobs:
|
|||
-Reset
|
||||
azPSVersion: "latest"
|
||||
|
||||
- name: Install ALZ PowerShell Module
|
||||
shell: pwsh
|
||||
run: |
|
||||
Install-Module -Name 'ALZ' -Force
|
||||
|
||||
- name: Update Policy Definition Bicep Input Files
|
||||
uses: azure/powershell@v1
|
||||
with:
|
||||
inlineScript: |
|
||||
cd ${{ github.workspace }}/${{ github.repository }}
|
||||
Write-Information "==> Running script..." -InformationAction Continue
|
||||
.github/scripts/Invoke-PolicyToBicep-China.ps1 `
|
||||
-alzToolsPath "${{ github.workspace }}/${{ env.remote_repository }}/src/Alz.Tools/"
|
||||
.github/scripts/Invoke-PolicyToBicep-China.ps1
|
||||
azPSVersion: "latest"
|
||||
|
||||
- name: Check for changes
|
||||
|
|
Загрузка…
Ссылка в новой задаче