Skip to content

Commit d288d3b

Browse files
authored
feat: Add Edit-LineEnding function and Invoke-EABillingSPNPermissionsSetup fucntions (#337)
# Pull Request ## Description Add Edit-LineEnding function and Invoke-EABillingSPNPermissionsSetup fucntions ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license.
1 parent f2033d8 commit d288d3b

32 files changed

+409
-234
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
trim_trailing_whitespace = true
6+
insert_final_newline = true
7+
8+
[*.{ps1,psm1,psd1}]
9+
indent_style = space
10+
indent_size = 4
11+
12+

.github/workflows/PullRequest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
pwsh: ['7.1.3']
16+
pwsh: ['7.1.3', '7.5.0']
1717
steps:
1818
- name: Check out repository
1919
uses: actions/checkout@v3

.github/workflows/super-linter.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
# VALIDATE_TERRAFORM_TERRASCAN: true # disabled for now as does not support TF 1.3 optional(type, default)
4343
VALIDATE_TERRAFORM_TFLINT: true
4444
VALIDATE_YAML: true
45+
VALIDATE_EDITORCONFIG: true
4546
# VALIDATE_GO: true # Disabled because it down not work :(
4647
# Additional settings:
4748
# If a shell script is not executable, the bash-exec

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ templates/.test_azuredevops
5454
templates/.test_github
5555
.vscode/settings.json
5656
/ALZ
57-
.tools
57+
.tools

actions_bootstrap.ps1

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ $null = $modulesToInstall.Add(([PSCustomObject]@{
2929
ModuleName = 'platyPS'
3030
ModuleVersion = '0.12.0'
3131
}))
32+
# Required for Invoke-EABillingSPNPermissionsSetup to work
33+
$null = $modulesToInstall.Add(([PSCustomObject]@{
34+
ModuleName = 'Az.Accounts'
35+
ModuleVersion = '2.10.4'
36+
}))
37+
$null = $modulesToInstall.Add(([PSCustomObject]@{
38+
ModuleName = 'Az.Resources'
39+
ModuleVersion = '6.5.0'
40+
}))
3241

3342
'Installing PowerShell Modules'
3443
foreach ($module in $modulesToInstall) {

docs/CHANGELOG.md

-39
This file was deleted.

src/ALZ.Settings.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# specify the minimum required major PowerShell version that the build script should validate
2-
[version]$script:requiredPSVersion = '5.1.0'
2+
[version]$script:requiredPSVersion = '7.1.3'

src/ALZ/ALZ.psd1

+26-16
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,33 @@
99
@{
1010

1111
# Script module or binary module file associated with this manifest.
12-
RootModule = 'ALZ.psm1'
12+
RootModule = 'ALZ.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.1.0'
15+
ModuleVersion = '0.1.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
1919

2020
# ID used to uniquely identify this module
21-
GUID = '74a4385f-281e-4776-bd7c-3b6a09d6ba63'
21+
GUID = '74a4385f-281e-4776-bd7c-3b6a09d6ba63'
2222

2323
# Author of this module
24-
Author = 'Microsoft Corporation'
24+
Author = 'Microsoft Corporation'
2525

2626
# Company or vendor of this module
27-
CompanyName = 'Microsoft Corporation'
27+
CompanyName = 'Microsoft Corporation'
2828

2929
# Copyright statement for this module
30-
Copyright = '(c) Microsoft Corporation. All rights reserved.'
30+
Copyright = '(c) Microsoft Corporation. All rights reserved.'
3131

3232
# Description of the functionality provided by this module
33-
Description = 'Azure Landing Zones Powershell Module'
33+
Description = 'Azure Landing Zones Powershell Module'
3434

3535
CompatiblePSEditions = 'Core'
3636

3737
# Minimum version of the PowerShell engine required by this module
38-
PowerShellVersion = '7.4'
38+
PowerShellVersion = '7.4'
3939

4040
# Name of the PowerShell host required by this module
4141
# PowerShellHostName = ''
@@ -53,7 +53,16 @@
5353
# ProcessorArchitecture = ''
5454

5555
# Modules that must be imported into the global environment prior to importing this module
56-
RequiredModules = @()
56+
RequiredModules = @(
57+
@{
58+
ModuleName = 'Az.Accounts'
59+
ModuleVersion = '2.10.4'
60+
},
61+
@{
62+
ModuleName = 'Az.Resources'
63+
ModuleVersion = '6.5.0'
64+
}
65+
)
5766

5867
# Assemblies that must be loaded prior to importing this module
5968
# RequiredAssemblies = @()
@@ -71,19 +80,20 @@
7180
# NestedModules = @()
7281

7382
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
74-
FunctionsToExport = @(
83+
FunctionsToExport = @(
7584
'Test-AcceleratorRequirement',
76-
'Deploy-Accelerator'
85+
'Deploy-Accelerator',
86+
'Invoke-EABillingSPNPermissionsSetup'
7787
)
7888

7989
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
80-
CmdletsToExport = @()
90+
CmdletsToExport = @()
8191

8292
# Variables to export from this module
83-
VariablesToExport = '*'
93+
VariablesToExport = '*'
8494

8595
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
86-
AliasesToExport = @()
96+
AliasesToExport = @()
8797

8898
# DSC resources to export from this module
8999
# DscResourcesToExport = @()
@@ -95,7 +105,7 @@
95105
# FileList = @()
96106

97107
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
98-
PrivateData = @{
108+
PrivateData = @{
99109

100110
PSData = @{
101111

@@ -112,7 +122,7 @@
112122
LicenseUri = 'https://github.com/Azure/ALZ-PowerShell-Module/blob/main/LICENSE'
113123

114124
# A URL to the main website for this project.
115-
ProjectUri = 'https://github.com/Azure/ALZ-Powershell-Module'
125+
ProjectUri = 'https://github.com/Azure/ALZ-PowerShell-Module'
116126

117127
# A URL to an icon representing this module.
118128
IconUri = 'https://raw.githubusercontent.com/Azure/ALZ-PowerShell-Module/main/docs/rsz_alzlogo.png'

src/ALZ/ALZ.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ foreach ($file in @($public + $private)) {
2828

2929

3030
# export all public functions
31-
Export-ModuleMember -Function $public.Basename -Alias *
31+
Export-ModuleMember -Function $public.Basename -Alias *

src/ALZ/Private/Config-Helpers/Convert-BicepConfigToInputConfig.ps1

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,52 @@ function Convert-BicepConfigToInputConfig {
1414
if ($PSCmdlet.ShouldProcess("Parse Interface Variables into Config", "modify")) {
1515

1616
$configItems = [PSCustomObject]@{}
17-
if($appendToObject -ne $null) {
17+
if ($appendToObject -ne $null) {
1818
$configItems = $appendToObject
1919
}
2020

2121
Write-Verbose $validators
2222

23-
foreach($variable in $bicepConfig.inputs.PSObject.Properties) {
23+
foreach ($variable in $bicepConfig.inputs.PSObject.Properties) {
2424
Write-Verbose "Parsing variable $($variable.Name)"
2525
$description = $variable.Value.description
2626

2727
$configItem = [PSCustomObject]@{}
2828
$configItem | Add-Member -NotePropertyName "Source" -NotePropertyValue $variable.Value.source
2929
$configItem | Add-Member -NotePropertyName "Value" -NotePropertyValue ""
3030

31-
if($variable.Value.PSObject.Properties.Name -contains "sourceInput") {
31+
if ($variable.Value.PSObject.Properties.Name -contains "sourceInput") {
3232
$configItem | Add-Member -NotePropertyName "SourceInput" -NotePropertyValue $variable.Value.sourceInput
3333
}
3434

35-
if($variable.Value.PSObject.Properties.Name -contains "pattern") {
35+
if ($variable.Value.PSObject.Properties.Name -contains "pattern") {
3636
$configItem | Add-Member -NotePropertyName "Pattern" -NotePropertyValue $variable.Value.pattern
3737
}
3838

39-
if($variable.Value.PSObject.Properties.Name -contains "process") {
39+
if ($variable.Value.PSObject.Properties.Name -contains "process") {
4040
$configItem | Add-Member -NotePropertyName "Process" -NotePropertyValue $variable.Value.process
4141
}
4242

43-
if($variable.Value.PSObject.Properties.Name -contains "default") {
43+
if ($variable.Value.PSObject.Properties.Name -contains "default") {
4444
$defaultValue = $variable.Value.default
4545
$configItem | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $defaultValue
4646
}
4747

48-
if($variable.Value.PSObject.Properties.Name -contains "validation") {
48+
if ($variable.Value.PSObject.Properties.Name -contains "validation") {
4949
$validationType = $variable.Value.validation
5050
$validator = $validators.PSObject.Properties[$validationType].Value
5151
$description = "$description ($($validator.Description))"
5252
Write-Verbose "Adding $($variable.Value.validation) validation for $($variable.Name). Validation type: $($validator.Type)"
53-
if($validator.Type -eq "AllowedValues"){
53+
if ($validator.Type -eq "AllowedValues") {
5454
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
5555
}
56-
if($validator.Type -eq "Valid"){
56+
if ($validator.Type -eq "Valid") {
5757
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
5858
}
5959
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
6060
}
6161

62-
if($variable.Value.PSObject.Properties.Name -contains "targets") {
62+
if ($variable.Value.PSObject.Properties.Name -contains "targets") {
6363
$configItem | Add-Member -NotePropertyName "targets" -NotePropertyValue $variable.Value.targets
6464
}
6565

@@ -69,4 +69,4 @@ function Convert-BicepConfigToInputConfig {
6969
}
7070

7171
return $configItems
72-
}
72+
}

src/ALZ/Private/Config-Helpers/Convert-HCLVariablesToInputConfig.ps1

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ function Convert-HCLVariablesToInputConfig {
1717
if ($PSCmdlet.ShouldProcess("Parse HCL Variables into Config", "modify")) {
1818
$terraformVariables = & $hclParserToolPath $targetVariableFile | ConvertFrom-Json
1919

20-
if($terraformVariables.PSObject.Properties.Name -notcontains "variable") {
20+
if ($terraformVariables.PSObject.Properties.Name -notcontains "variable") {
2121
Write-Verbose "No variables found in $targetVariableFile, skipping..."
2222
return $appendToObject
2323
}
2424

2525
Write-Verbose "Variables found in $targetVariableFile, processing..."
2626

2727
$configItems = [PSCustomObject]@{}
28-
if($appendToObject -ne $null) {
28+
if ($appendToObject -ne $null) {
2929
$configItems = $appendToObject
3030
}
3131

32-
foreach($variable in $terraformVariables.variable.PSObject.Properties) {
33-
if($variable.Value[0].PSObject.Properties.Name -contains "description") {
32+
foreach ($variable in $terraformVariables.variable.PSObject.Properties) {
33+
if ($variable.Value[0].PSObject.Properties.Name -contains "description") {
3434
$description = $variable.Value[0].description
3535
$validationTypeSplit = $description -split "\|"
3636

3737
$hasValidation = $false
3838

39-
if($validationTypeSplit.Length -gt 1) {
39+
if ($validationTypeSplit.Length -gt 1) {
4040
$description = $validationTypeSplit[0].Trim()
4141
}
4242

43-
if($validationTypeSplit.Length -eq 2) {
43+
if ($validationTypeSplit.Length -eq 2) {
4444
$splitItem = $validationTypeSplit[1].Trim()
4545
$validationType = $splitItem
4646
$hasValidation = $true
@@ -51,17 +51,17 @@ function Convert-HCLVariablesToInputConfig {
5151
$configItem | Add-Member -NotePropertyName "Value" -NotePropertyValue ""
5252
$configItem | Add-Member -NotePropertyName "Source" -NotePropertyValue "input"
5353

54-
if($variable.Value[0].PSObject.Properties.Name -contains "default") {
54+
if ($variable.Value[0].PSObject.Properties.Name -contains "default") {
5555
$configItem | Add-Member -NotePropertyName "DefaultValue" -NotePropertyValue $variable.Value[0].default
5656
}
5757

58-
if($hasValidation) {
58+
if ($hasValidation) {
5959
$validator = $validators.PSObject.Properties[$validationType].Value
6060
$description = "$description ($($validator.Description))"
61-
if($validator.Type -eq "AllowedValues"){
61+
if ($validator.Type -eq "AllowedValues") {
6262
$configItem | Add-Member -NotePropertyName "AllowedValues" -NotePropertyValue $validator.AllowedValues
6363
}
64-
if($validator.Type -eq "Valid"){
64+
if ($validator.Type -eq "Valid") {
6565
$configItem | Add-Member -NotePropertyName "Valid" -NotePropertyValue $validator.Valid
6666
}
6767
$configItem | Add-Member -NotePropertyName "Validator" -NotePropertyValue $validationType
@@ -75,4 +75,4 @@ function Convert-HCLVariablesToInputConfig {
7575
}
7676

7777
return $configItems
78-
}
78+
}

src/ALZ/Private/Config-Helpers/Convert-ParametersToInputConfig.ps1

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ function Convert-ParametersToInputConfig {
66
[hashtable] $parameters
77
)
88

9-
foreach($parameterKey in $parameters.Keys) {
9+
foreach ($parameterKey in $parameters.Keys) {
1010
$parameter = $parameters[$parameterKey]
1111
Write-Verbose "Processing parameter $parameterKey $(ConvertTo-Json $parameter -Depth 100)"
1212

13-
foreach($parameterAlias in $parameter.aliases) {
14-
if($inputConfig.PsObject.Properties.Name -contains $parameterAlias) {
13+
foreach ($parameterAlias in $parameter.aliases) {
14+
if ($inputConfig.PsObject.Properties.Name -contains $parameterAlias) {
1515
Write-Verbose "Alias $parameterAlias exists in input config, renaming..."
1616
$configItem = $inputConfig.PSObject.Properties | Where-Object { $_.Name -eq $parameterAlias }
1717
$inputConfig | Add-Member -NotePropertyName $parameterKey -NotePropertyValue @{
@@ -23,17 +23,17 @@ function Convert-ParametersToInputConfig {
2323
}
2424
}
2525

26-
if($inputConfig.PsObject.Properties.Name -notcontains $parameterKey) {
26+
if ($inputConfig.PsObject.Properties.Name -notcontains $parameterKey) {
2727
$variableValue = [Environment]::GetEnvironmentVariable("ALZ_$($parameterKey)")
28-
if($null -eq $variableValue) {
29-
if($parameter.type -eq "SwitchParameter") {
28+
if ($null -eq $variableValue) {
29+
if ($parameter.type -eq "SwitchParameter") {
3030
$variableValue = $parameter.value.IsPresent
3131
} else {
3232
$variableValue = $parameter.value
3333
}
3434
}
3535

36-
if($parameter.type -eq "SwitchParameter") {
36+
if ($parameter.type -eq "SwitchParameter") {
3737
$variableValue = [bool]::Parse($variableValue)
3838
}
3939
Write-Verbose "Adding parameter $parameterKey with value $variableValue"
@@ -45,4 +45,4 @@ function Convert-ParametersToInputConfig {
4545
}
4646

4747
return $inputConfig
48-
}
48+
}

src/ALZ/Private/Config-Helpers/Format-TokenizedConfigurationString.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ function Format-TokenizedConfigurationString {
2323
}
2424

2525
return $returnValue
26-
}
26+
}

0 commit comments

Comments
 (0)