Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 8 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,30 @@

## Introduction

TLDR: Head straight over to our [Quick Start](https://github.com/Azure/ALZ-PowerShell-Module/wiki/%5BUser-Guide%5D-Quick-Start) to get going now.

This repository contains the PowerShell module and documentation for the Azure landing zones Accelerators for Bicep and Terraform. The accelerators are an opinionated implementation of the Azure Landing Zones Terraform modules, with Azure DevOps or GitHub bootstrapping.

It is designed to be used as a template to enable you to get started quickly deploying ALZ with Bicep or Terraform.

Please refer to our [Wiki](https://github.com/Azure/ALZ-PowerShell-Module/wiki) for detailed features and usage instructions.
Please refer to our [Docs](https://aka.ms/alz/acc) for detailed features and usage instructions.

## Quick Start

To get going right now, run these PowerShell steps:

```pwsh
Install-Module -Name ALZ
Deploy-Accelerator
```

## More Examples

Here are more examples with different options:

### Azure Landing Zone Environment with Bicep and GitHub Actions Workflows

```powershell
Deploy-Accelerator -o <output_directory> -i "bicep" -b "alz_github"
Deploy-Accelerator -inputs "inputs.yaml"
```

### Azure Landing Zone Environment with Bicep and Azure DevOps Pipelines
## Software Requirements

```powershell
Deploy-Accelerator -o <output_directory> -i "bicep" -b "alz_azuredevops"
```

### Azure Landing Zone Environment with Terraform and GitHub Pipelines

```powershell
Deploy-Accelerator -o <output_directory> -i "terraform" -b "alz_github"
```
You can see the software requirements for the ALZ Accelerators in the [Phase 1 Docs](https://aka.ms/alz/acc/phase1).

### Azure Landing Zone Environment with Terraform and Azure DevOps Pipelines
To check the requirements, run these commands:

```powershell
Deploy-Accelerator -o <output_directory> -i "terraform" -b "alz_azuredevops"
```pwsh
Install-Module -Name ALZ
Test-AcceleratorRequirements
```

## Contributing
Expand Down
13 changes: 3 additions & 10 deletions src/ALZ/ALZ.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@

# 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.
FunctionsToExport = @(
'New-ALZEnvironment'
'Test-ALZRequirement'
'Edit-LineEnding'
'Test-AcceleratorRequirement',
'Deploy-Accelerator'
)

# 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.
Expand All @@ -84,10 +83,7 @@
VariablesToExport = '*'

# 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.
AliasesToExport = @(
'Edit-LineEndings'
'Deploy-Accelerator'
)
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()
Expand Down Expand Up @@ -142,7 +138,4 @@

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}


111 changes: 111 additions & 0 deletions src/ALZ/Private/Tools/Test-Tooling.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
function Test-Tooling {
$checkResults = @()
$hasFailure = $false

# Check if PowerShell is the correct version
Write-Verbose "Checking PowerShell version"
$powerShellVersionTable = $PSVersionTable
$powerShellVersion = $powerShellVersionTable.PSVersion.ToString()
if ($powerShellVersionTable.PSVersion.Major -lt 7) {
$checkResults += @{
message = "PowerShell version $powerShellVersion is not supported. Please upgrade to PowerShell 7.4 or higher. Either switch to the `pwsh` prompt or follow the instructions here: https://aka.ms/install-powershell"
result = "Failure"
}
$hasFailure = $true
} elseif ($powerShellVersionTable.PSVersion.Major -eq 7 -and $powerShellVersionTable.PSVersion.Minor -lt 4) {
$checkResults += @{
message = "PowerShell version $powerShellVersion is not supported. Please upgrade to PowerShell 7.4 or higher. Either switch to the `pwsh` prompt or follow the instructions here: https://aka.ms/install-powershell"
result = "Failure"
}
$hasFailure = $true
} else {
$checkResults += @{
message = "PowerShell version $powerShellVersion is supported."
result = "Success"
}
}

# Check if Git is installed
Write-Verbose "Checking Git installation"
$gitPath = Get-Command git -ErrorAction SilentlyContinue
if ($gitPath) {
$checkResults += @{
message = "Git is installed."
result = "Success"
}
} else {
$checkResults += @{
message = "Git is not installed. Follow the instructions here: https://git-scm.com/downloads"
result = "Failure"
}
$hasFailure = $true
}

# Check if Azure CLI is installed
Write-Verbose "Checking Azure CLI installation"
$azCliPath = Get-Command az -ErrorAction SilentlyContinue
if ($azCliPath) {
$checkResults += @{
message = "Azure CLI is installed."
result = "Success"
}
} else {
$checkResults += @{
message = "Azure CLI is not installed. Follow the instructions here: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli"
result = "Failure"
}
$hasFailure = $true
}

# Check if Azure CLI is logged in
Write-Verbose "Checking Azure CLI login status"
$azCliAccount = $(az account show -o json) | ConvertFrom-Json
if ($azCliAccount) {
$checkResults += @{
message = "Azure CLI is logged in. Tenant ID: $($azCliAccount.tenantId), Subscription: $($azCliAccount.name) ($($azCliAccount.id))"
result = "Success"
}
} else {
$checkResults += @{
message = "Azure CLI is not logged in. Please login to Azure CLI using 'az login -t `"00000000-0000-0000-0000-000000000000}`"', replacing the empty GUID with your tenant ID."
result = "Failure"
}
$hasFailure = $true
}

# Check if latest ALZ module is installed
Write-Verbose "Checking ALZ module version"
$alzModuleCurrentVersion = Get-InstalledModule -Name ALZ
$alzModuleLatestVersion = Find-Module -Name ALZ
if ($alzModuleCurrentVersion.Version -lt $alzModuleLatestVersion.Version) {
$checkResults += @{
message = "ALZ module is not the latest version. Your version: $($alzModuleCurrentVersion.Version), Latest version: $($alzModuleLatestVersion.Version). Please update to the latest version using 'Update-Module ALZ'."
result = "Failure"
}
$hasFailure = $true
} else {
$checkResults += @{
message = "ALZ module is the latest version ($($alzModuleCurrentVersion.Version))."
result = "Success"
}
}

Write-Verbose "Showing check results"
$checkResults | ForEach-Object {[PSCustomObject]$_} | Format-Table -Property @{
Label = "Check Result"; Expression = {
switch ($_.result) {
'Success' { $color = "92"; break }
'Failure' { $color = "91"; break }
default { $color = "0" }
}
$e = [char]27
"$e[${color}m$($_.result)${e}[0m"
}
}, @{ Label = "Check Details"; Expression = {$_.message} } -AutoSize -Wrap

if($hasFailure) {
Write-InformationColored "Accelerator software requirements have no been met, please review and install the missing software." -ForegroundColor Red -InformationAction Continue
Write-InformationColored "Cannot continue with Deployment..." -ForegroundColor Red -InformationAction Continue
throw "Accelerator software requirements have no been met, please review and install the missing software."
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function New-ALZEnvironment {
function Deploy-Accelerator {
<#
.SYNOPSIS
Deploys an accelerator according to the supplied inputs.
Expand Down Expand Up @@ -169,11 +169,26 @@ function New-ALZEnvironment {
)]
[Alias("tj")]
[Alias("convertTfvarsToJson")]
[switch] $convert_tfvars_to_json
[switch] $convert_tfvars_to_json,

[Parameter(
Mandatory = $false,
HelpMessage = "[OPTIONAL] Determines whether to skip the requirements check. This is not recommended."
)]
[Alias("sr")]
[Alias("skipRequirementsCheck")]
[switch] $skip_requirements_check
)

$ProgressPreference = "SilentlyContinue"

if(-not $skip_requirements_check) {
Write-InformationColored "Checking the software requirements for the Accelerator..." -ForegroundColor Green -InformationAction Continue
Test-Tooling
} else {
Write-InformationColored "Skipping the software requirements check..." -ForegroundColor Yellow -InformationAction Continue
}

Write-InformationColored "Getting ready to deploy the accelerator with you..." -ForegroundColor Green -InformationAction Continue

if ($PSCmdlet.ShouldProcess("Accelerator setup", "modify")) {
Expand Down Expand Up @@ -366,5 +381,3 @@ function New-ALZEnvironment {

return
}

New-Alias -Name "Deploy-Accelerator" -Value "New-ALZEnvironment"
43 changes: 0 additions & 43 deletions src/ALZ/Public/Edit-LineEnding.ps1

This file was deleted.

97 changes: 0 additions & 97 deletions src/ALZ/Public/Test-ALZRequirement.ps1

This file was deleted.

Loading
Loading