Microsoft Azure As Built Report is a PowerShell module which works in conjunction with AsBuiltReport.Core.
AsBuiltReport is an open-sourced community project which utilises PowerShell to produce as-built documentation in multiple document formats for multiple vendors and technologies.
Please refer to the AsBuiltReport website for more detailed information about this project.
The Microsoft Azure As Built Report currently supports reporting for the following Azure resources;
- Availability Sets
- Bastion Hosts
- ExpressRoute Circuits
- Firewalls
- IP Groups
- Key Vaults
- Load Balancers
- Policies
- Private DNS Resolvers
- Route Tables
- Storage Accounts
- Subscriptions
- Tenants
- Virtual Machines
- Virtual Networks
Below are the instructions on how to install, configure and generate a Microsoft Azure As Built report.
This report is compatible with the following PowerShell versions;
Windows PowerShell 5.1 | PowerShell 7 |
---|---|
✅ | ✅ |
PowerShell 5.1 or PowerShell 7, and the following PowerShell modules are required for generating a Microsoft Azure As Built Report.
The Microsoft Azure as built report requires an Azure AD account. This report will not work with personal Azure accounts.
The least privileged roles required to generate a Microsoft Azure As Built Report are;
- Reader
- Backup Reader
Open a PowerShell terminal window and install each of the required modules.
Note
Microsoft Az 12.0.0 or higher is required. Please ensure older Az modules have been uninstalled.
# Install
install-module Az -Repository PSGallery -MinimumVersion 12.0.0 -Force
install-module AsBuiltReport.Microsoft.Azure -Repository PSGallery -Force
# Update
update-module Az -Force
update-module AsBuiltReport.Microsoft.Azure -Force
If you are unable to use the PowerShell Gallery, you can still install the module manually. Ensure you repeat the following steps for the system requirements also.
- Download the code package / latest release zip from GitHub
- Extract the zip file
- Copy the folder
AsBuiltReport.Microsoft.Azure
to a path that is set in$env:PSModulePath
. - Open a PowerShell terminal window and unblock the downloaded files with
$path = (Get-Module -Name AsBuiltReport.Microsoft.Azure -ListAvailable).ModuleBase; Unblock-File -Path $path\*.psd1; Unblock-File -Path $path\Src\Public\*.ps1; Unblock-File -Path $path\Src\Private\*.ps1
- Close and reopen the PowerShell terminal window.
Note: You are not limited to installing the module to those example paths, you can add a new entry to the environment variable PSModulePath if you want to use another path.
The Microsoft Azure As Built Report utilises a JSON file to allow configuration of report information, options, detail and healthchecks.
Important
Please remember to generate a new report JSON configuration file after each module update to ensure the report functions correctly.
A Microsoft Azure report configuration file can be generated by executing the following command;
New-AsBuiltReportConfig -Report Microsoft.Azure -FolderPath <User specified folder> -Filename <Optional>
Executing this command will copy the default Microsoft Azure report JSON configuration to a user specified folder.
All report settings can then be configured via the JSON file.
The following provides information of how to configure each schema within the report's JSON file.
The Report schema provides configuration of the Microsoft Azure report information.
Sub-Schema | Setting | Default | Description |
---|---|---|---|
Name | User defined | Microsoft Azure As Built Report | The name of the As Built Report |
Version | User defined | 1.0 | The report version |
Status | User defined | Released | The report release status |
ShowCoverPageImage | true / false | true | Toggle to enable/disable the display of the cover page image |
ShowTableOfContents | true / false | true | Toggle to enable/disable table of contents |
ShowHeaderFooter | true / false | true | Toggle to enable/disable document headers & footers |
ShowTableCaptions | true / false | true | Toggle to enable/disable table captions/numbering |
The Options schema allows certain options within the report to be toggled on or off.
Sub-Schema | Setting | Default | Description |
---|---|---|---|
ShowSectionInfo | true / false | true | Toggle to enable/disable information relating to Azure resources within each section. |
ShowTags | true / false | true | Toggle to enable/disable the display of Azure resource tags. Note: Reporting of tags is not currently available on all Azure resources. Tags will only be displayed for Azure resources when the relevant section InfoLevel is configured to 2 or higher. |
The Filter schema allows report content to be filtered to specific Azure subscriptions within a tenant.
Sub-Schema | Setting | Default | Description |
---|---|---|---|
Subscription | User defined | * | Filters report content to specific Azure subscription IDs within a tenant. Specifying an asterisk (*) will generate a report for all Azure subscriptions within a tenant. |
"Filter": {
"Subscription": ["*"]
},
"Filter": {
"Subscription": ["555fff88-777d-1234-987a-23bc67890z5","666dfg67-654h-1234-984f-08kb67834y8"]
},
The InfoLevel schema allows configuration of each section of the report at a granular level. The following sections can be set.
There are 4 levels (0-3) of detail granularity for each section as follows;
Setting | InfoLevel | Description |
---|---|---|
0 | Disabled | Does not collect or display any information |
1 | Enabled / Summary | Provides summarised information for a collection of objects |
2 | Detailed | Provides detailed information for individual objects |
3 | Comprehensive | Provides comprehensive information for individual objects, such as advanced configuration settings |
The table below outlines the default and maximum InfoLevel settings for each section.
Sub-Schema | Default Setting | Maximum Setting |
---|---|---|
AvailabilitySet | 1 | 1 |
Bastion | 1 | 2 |
DnsPrivateResolver | 1 | 2 |
ExpressRoute | 1 | 2 |
Firewall | 1 | 3 |
IpGroup | 1 | 2 |
KeyVault | 1 | 1 |
LoadBalancer | 1 | 2 |
NetworkSecurityGroup | 1 | 2 |
Policy > Assignments | 1 | 2 |
Policy > Definitions | 0 | 1 |
RecoveryServicesVault | 1 | 2 |
RouteTable | 1 | 2 |
SiteRecovery | 1 | 1 |
StorageAccount | 1 | 2 |
Subscription | 1 | 1 |
Tenant | 1 | 1 |
VirtualNetwork | 1 | 2 |
VirtualMachine | 1 | 2 |
The Healthcheck schema is used to toggle health checks on or off.
The ExpressRoute schema is used to configure health checks for Azure ExpressRoute.
Sub-Schema | Setting | Default | Description | Highlight |
---|---|---|---|---|
CircuitStatus | true / false | true | Highlights ExpressRoute circuits which are disabled | ExpressRoute circuit is disabled |
The SiteRecovery schema is used to configure health checks for Azure Site Recovery.
The StorageAccount schema is used to configure health checks for Azure Storage Account.
The VirtualMachine schema is used to configure health checks for Azure Virtual Machines.
# Generate a Microsoft Azure As Built Report for Tenant ID '555fff88-777d-1234-987a-23bc67890z5' using multifactor authentication. Export report to HTML & DOCX formats. Use default report style. Append timestamp to report filename. Save reports to 'C:\Users\Tim\Documents'
PS C:\> New-AsBuiltReport -Report Microsoft.Azure -Target '555fff88-777d-1234-987a-23bc67890z5' -MFA -Format Html,Word -OutputFolderPath 'C:\Users\Tim\Documents' -Timestamp
# Generate a Microsoft Azure As Built Report for Tenant ID '555fff88-777d-1234-987a-23bc67890z5' using specified credentials and report configuration file. Export report to Text, HTML & DOCX formats. Use default report style. Save reports to 'C:\Users\Tim\Documents'. Display verbose messages to the console.
PS C:\> New-AsBuiltReport -Report Microsoft.Azure -Target '555fff88-777d-1234-987a-23bc67890z5' -Username 'tim@acme.com' -Password 'MyP@ssw0rd!' -Format Text,Html,Word -OutputFolderPath 'C:\Users\Tim\Documents' -ReportConfigFilePath 'C:\Users\Tim\AsBuiltReport\AsBuiltReport.Microsoft.Azure.json' -Verbose
# Generate a Microsoft Azure As Built Report for Tenant ID '555fff88-777d-1234-987a-23bc67890z5' using stored credentials. Export report to HTML & Text formats. Use default report style. Highlight environment issues within the report. Save reports to 'C:\Users\Tim\Documents'.
PS C:\> $Creds = Get-Credential
PS C:\> New-AsBuiltReport -Report Microsoft.Azure -Target '555fff88-777d-1234-987a-23bc67890z5' -Credential $Creds -Format Html,Text -OutputFolderPath 'C:\Users\Tim\Documents' -EnableHealthCheck
# Generate a Microsoft Azure As Built Report for Tenant ID '555fff88-777d-1234-987a-23bc67890z5' using specified credentials. Report exports to WORD format by default. Apply custom style to the report. Reports are saved to the user profile folder by default.
PS C:\> New-AsBuiltReport -Report Microsoft.Azure -Target '555fff88-777d-1234-987a-23bc67890z5' -Username 'joe@acme.com' -Password 'MyP@ssw0rd!' -StyleFilePath 'C:\Scripts\Styles\MyCustomStyle.ps1'
# Generate a Microsoft Azure As Built Report for Tenant ID '555fff88-777d-1234-987a-23bc67890z5' using multifactor authentication. Export report to HTML & DOCX formats. Use default report style. Reports are saved to the user profile folder by default. Attach and send reports via e-mail.
PS C:\> New-AsBuiltReport -Report Microsoft.Azure -Target '555fff88-777d-1234-987a-23bc67890z5' -MFA -Format Html,Word -OutputFolderPath 'C:\Users\Tim\Documents' -SendEmail