Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of a column with Linked Virtual Network's name #63

Merged
merged 1 commit into from
May 12, 2022
Merged
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
18 changes: 15 additions & 3 deletions Modules/Networking/PrivateDNS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ param($SCPath, $Sub, $Intag, $Resources, $Task , $File, $SmaResources, $TableSty
If ($Task -eq 'Processing') {

$PrivateDNS = $Resources | Where-Object { $_.TYPE -eq 'microsoft.network/privatednszones' }
$VNETLinks = $Resources | Where-Object { $_.TYPE -eq 'microsoft.network/privatednszones/virtualnetworklinks' }

if($PrivateDNS)
{
Expand All @@ -34,7 +35,14 @@ If ($Task -eq 'Processing') {
$ResUCount = 1
$sub1 = $SUB | Where-Object { $_.Id -eq $1.subscriptionId }
$data = $1.PROPERTIES
$Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}

$vnlks = ($VNETLinks | where {$_.id -like ($1.id + '*')})
$vnlks = if (!$vnlks) {[pscustomobject]@{id = 'none'}} else {$vnlks | Select-Object @{Name="id";Expression={$_.properties.virtualNetwork.id.split("/")[8]}}}

foreach ($2 in $vnlks) {

$Tags = if(![string]::IsNullOrEmpty($1.tags.psobject.properties)){$1.tags.psobject.properties}else{'0'}

foreach ($Tag in $Tags) {
$obj = @{
'ID' = $1.id;
Expand All @@ -46,11 +54,14 @@ If ($Task -eq 'Processing') {
'Virtual Network Links' = $data.numberOfVirtualNetworkLinks;
'Network Links with Registration' = $data.numberOfVirtualNetworkLinksWithRegistration;
'Tag Name' = [string]$Tag.Name;
'Tag Value' = [string]$Tag.Value
'Tag Value' = [string]$Tag.Value;
'Virtual Network' = $2.id
}

$tmp += $obj
if ($ResUCount -eq 1) { $ResUCount = 0 }
}
}
}
}
$tmp
}
Expand All @@ -70,6 +81,7 @@ Else {
$Exc.Add('Location')
$Exc.Add('Number of Records')
$Exc.Add('Virtual Network Links')
$Exc.Add('Virtual Network')
$Exc.Add('Network Links with Registration')
if($InTag)
{
Expand Down