Skip to content

Commit 6966050

Browse files
authored
Merge pull request #14 from AsBuiltReport/dev
v0.1.6 release
2 parents e13d536 + 61ee12e commit 6966050

File tree

7 files changed

+115
-5
lines changed

7 files changed

+115
-5
lines changed

.github/workflows/PSScriptAnalyzer.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ jobs:
1313
failOnErrors: true
1414
failOnWarnings: false
1515
failOnInfos: false
16-
repoToken: ${{ secrets.GITHUB_TOKEN }}
17-
settingsPath: .github/workflows/PSScriptAnalyzerSettings.psd1
16+
settingsPath: .github/workflows/PSScriptAnalyzerSettings.psd1

AsBuiltReport.Microsoft.Azure.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"NetworkSecurityGroup": 1,
2727
"PolicyAssignment": 1,
2828
"RecoveryServicesVault": 1,
29+
"RouteTable": 1,
2930
"SiteRecovery": 1,
3031
"StorageAccount": 1,
3132
"VirtualNetwork": 1,

AsBuiltReport.Microsoft.Azure.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'AsBuiltReport.Microsoft.Azure.psm1'
1313

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

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -109,7 +109,7 @@ PrivateData = @{
109109
ProjectUri = 'https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Azure'
110110

111111
# A URL to an icon representing this module.
112-
IconUri = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport/master/AsBuiltReport.png'
112+
IconUri = 'https://github.com/AsBuiltReport.png'
113113

114114
# ReleaseNotes of this module
115115
ReleaseNotes = 'https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport.Microsoft.Azure/master/CHANGELOG.md'

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# :arrows_clockwise: Microsoft Azure As Built Report Changelog
22

3+
## [[0.1.6](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Azure/releases/tag/v0.1.6)] - 2023-11-14
4+
5+
### Added
6+
* Added initial support for Route Tables (@howardhaooooo)
7+
38
## [[0.1.5](https://github.com/AsBuiltReport/AsBuiltReport.Microsoft.Azure/releases/tag/v0.1.5)] - 2023-05-24
49

510
### Added

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- ********** DO NOT EDIT THESE LINKS ********** -->
22
<p align="center">
33
<a href="https://www.asbuiltreport.com/" alt="AsBuiltReport"></a>
4-
<img src='https://raw.githubusercontent.com/AsBuiltReport/AsBuiltReport/master/AsBuiltReport.png' width="8%" height="8%" /></a>
4+
<img src='https://github.com/AsBuiltReport.png' width="8%" height="8%" /></a>
55
</p>
66
<p align="center">
77
<a href="https://www.powershellgallery.com/packages/AsBuiltReport.Microsoft.Azure/" alt="PowerShell Gallery Version">
@@ -47,6 +47,7 @@ The Microsoft Azure As Built Report currently supports reporting for the followi
4747
* Key Vaults
4848
* Load Balancers
4949
* Policies
50+
* Route Tables
5051
* Storage Accounts
5152
* Subscriptions
5253
* Tenants
@@ -190,6 +191,7 @@ The table below outlines the default and maximum **InfoLevel** settings for each
190191
| LoadBalancer | 1 | 2 |
191192
| PolicyAssignment | 1 | 1 |
192193
| RecoveryServicesVault | 1 | 2 |
194+
| RouteTable | 1 | 2 |
193195
| SiteRecovery | 1 | 1 |
194196
| StorageAccount | 1 | 2 |
195197
| VirtualNetwork | 1 | 2 |
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
function Get-AbrAzRouteTable {
2+
<#
3+
.SYNOPSIS
4+
Used by As Built Report to retrieve Azure Route Table and Routes information
5+
.DESCRIPTION
6+
7+
.NOTES
8+
Version: 0.2
9+
Author: Howard Hao & Tim Carman
10+
Twitter: tpcarman
11+
Github: howardhaooooo / tpcarman
12+
.EXAMPLE
13+
14+
.LINK
15+
16+
#>
17+
[CmdletBinding()]
18+
param (
19+
)
20+
21+
begin {
22+
Write-PScriboMessage "RouteTable InfoLevel set at $($InfoLevel.RouteTable)."
23+
}
24+
25+
process {
26+
$AzRouteTables = Get-AzRouteTable | Sort-Object Name
27+
if (($InfoLevel.RouteTable -gt 0) -and ($AzRouteTables)) {
28+
Write-PscriboMessage "Collecting Azure Route Table information."
29+
Section -Style Heading4 'Route Tables' {
30+
if ($Options.ShowSectionInfo) {
31+
Paragraph "Azure Route Tables are a set of custom routes that dictate how network traffic should move within a virtual network (VNet). They offer a way to control the flow of data, ensuring it reaches the correct endpoint. For instance, if a subnet in a VNet needs to communicate with a virtual appliance, an Azure Route Table can direct the traffic accordingly."
32+
BlankLine
33+
}
34+
$AzRouteTableInfo = @()
35+
foreach ($AzRouteTable in $AzRouteTables) {
36+
$InObj = [Ordered]@{
37+
'Name' = $AzRouteTable.Name
38+
'Resource Group' = $AzRouteTable.ResourceGroupName
39+
'Location' = $AzLocationLookup."$($AzRouteTable.Location)"
40+
'Subscription' = "$($AzSubscriptionLookup.(($AzRouteTable.Id).split('/')[2]))"
41+
'Provisioning State' = $AzRouteTable.ProvisioningState
42+
}
43+
$AzRouteTableInfo += [PSCustomObject]$InObj
44+
}
45+
46+
if ($InfoLevel.RouteTable -eq 1) {
47+
Paragraph "The following table summarises the configuration of the Route Table within the $($AzSubscription.Name) subscription."
48+
BlankLine
49+
} else {
50+
Paragraph "The following sections detail the configuration of the Route Tables within the $($AzSubscription.Name) subscription."
51+
BlankLine
52+
}
53+
$TableParams = @{
54+
Name = "Route Tables - $($AzSubscription.Name)"
55+
List = $false
56+
Columns = 'Name', 'Resource Group', 'Location', 'Subscription'
57+
ColumnWidths = 25, 25, 25, 25
58+
}
59+
if ($Report.ShowTableCaptions) {
60+
$TableParams['Caption'] = "- $($TableParams.Name)"
61+
}
62+
$AzRouteTableInfo | Table @TableParams
63+
64+
if ($InfoLevel.RouteTable -ge 2) {
65+
foreach ($AzRouteTable in $AzRouteTables) {
66+
$AzRoutes = $AzRouteTable.Routes | Sort-Object Name
67+
if ($AzRoutes) {
68+
Section -Style NOTOCHeading5 -ExcludeFromTOC "$($AzRouteTable.Name)" {
69+
Section -Style NOTOCHeading6 -ExcludeFromTOC "Routes" {
70+
$AzRouteInfo = @()
71+
foreach ($AzRoute in $AzRoutes){
72+
$InObj = [Ordered]@{
73+
'Name' = $AzRoute.Name
74+
'Address Prefix' = $AzRoute.AddressPrefix
75+
'Next Hop Type' = $AzRoute.NextHopType
76+
'Next Hop IP Address' = Switch ($AzRoute.NextHopIpAddress) {
77+
"" { '--' }
78+
default { $AzRoute.NextHopIpAddress }
79+
}
80+
}
81+
$AzRouteInfo += [PSCustomObject]$InObj
82+
}
83+
$TableParams = @{
84+
Name = "Routes - $($AzRouteTable.Name)"
85+
List = $false
86+
ColumnWidths = 25, 25, 25, 25
87+
}
88+
if ($Report.ShowTableCaptions) {
89+
$TableParams['Caption'] = "- $($TableParams.Name)"
90+
}
91+
$AzRouteInfo | Table @TableParams
92+
}
93+
}
94+
}
95+
}
96+
}
97+
}
98+
}
99+
}
100+
101+
end {}
102+
}

Src/Public/Invoke-AsBuiltReport.Microsoft.Azure.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function Invoke-AsBuiltReport.Microsoft.Azure {
100100
Get-AbrAzLoadBalancer
101101
Get-AbrAzVirtualNetwork
102102
Get-AbrAzNetworkSecurityGroup
103+
Get-AbrAzRouteTable
103104
Get-AbrAzVirtualMachine
104105
Get-AbrAzRecoveryServicesVault
105106
Get-AbrAsrProtectedItems

0 commit comments

Comments
 (0)