Skip to content

Commit

Permalink
3.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudio-Merola committed Feb 17, 2024
1 parent 34d3a98 commit ef5194a
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AzureResourceInventory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ param ($TenantID,
Write-Host " -SkipAdvisory : Do not collect Azure Advisory. "
Write-Host " -SecurityCenter : Include Security Center Data. "
Write-Host " -IncludeTags : Include Resource Tags. "
Write-Host " -Diagram : Create a Visio Diagram. "
Write-Host " -Diagram : Create a Draw.IO Diagram. "
Write-Host " -Online : Use Online Modules. "
Write-Host " -Debug : Run in a Debug mode. "
Write-Host " -AzureEnvironment : Change the Azure Cloud Environment. "
Write-Host " -ReportName : Change the Default Name of the report. "
Write-Host " -ReportDir : Change the Default path of the report. "
Write-Host " -ReportDir : Change the Default Path of the report. "
Write-Host ""
Write-Host ""
Write-Host ""
Expand Down
102 changes: 102 additions & 0 deletions Modules/Networking/PrivateEndpoint.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<#
.Synopsis
Inventory for Azure Private Endpoint
.DESCRIPTION
This script consolidates information for all microsoft.network/privatednszones and resource provider in $Resources variable.
Excel Sheet Name: PvtEndpoint
.Link
https://github.com/microsoft/ARI/Modules/Networking/PrivateEndpoint.ps1
.COMPONENT
This powershell Module is part of Azure Resource Inventory (ARI)
.NOTES
Version: 3.1.13
First Release Date: 19th November, 2020
Authors: Claudio Merola and Renato Gregio
#>

<######## Default Parameters. Don't modify this ########>

param($SCPath, $Sub, $Intag, $Resources, $Task , $File, $SmaResources, $TableStyle, $Unsupported)
If ($Task -eq 'Processing') {

$PrivateEdp = $Resources | Where-Object { $_.TYPE -eq 'microsoft.network/privateendpoints' }

if($PrivateEdp)
{
$tmp = @()

foreach ($1 in $PrivateEdp) {
$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'}

$VNET = if(![string]::IsNullOrEmpty($data.subnet.id)){$data.subnet.id.split('/')[8]}else{''}
$Subnet = if(![string]::IsNullOrEmpty($data.subnet.id)){$data.subnet.id.split('/')[10]}else{''}

foreach ($Tag in $Tags) {
$obj = @{
'ID' = $1.id;
'Subscription' = $sub1.Name;
'Resource Group' = $1.RESOURCEGROUP;
'Name' = $1.NAME;
'Location' = $1.LOCATION;
'VNET' = $VNET;
'Subnet' = $Subnet;
'Private Link Name' = $data.privateLinkServiceConnections.name;
'Private Link Status' = $data.privatelinkserviceconnections.properties.privateLinkServiceConnectionState.status;
'Private Link Resource Type' = [string]$data.privatelinkserviceconnections.properties.groupids;
'Private Link Target Resource' = [string]$data.privatelinkserviceconnections.properties.privatelinkserviceid;
'IP Address' = [string]$data.customDnsConfigs.ipAddresses;
'FQDN' = [string]$data.customDnsConfigs.fqdn;
'Tag Name' = [string]$Tag.Name;
'Tag Value' = [string]$Tag.Value;
}
$tmp += $obj
if ($ResUCount -eq 1) { $ResUCount = 0 }
}
}
$tmp
}
}
Else {
if ($SmaResources.PrivateEndpoint) {

$TableName = ('PvtEndpointTable_'+($SmaResources.PrivateEndpoint.id | Select-Object -Unique).count)
$Style = New-ExcelStyle -HorizontalAlignment Center -AutoSize -NumberFormat 0

$condtxt = @()

$Exc = New-Object System.Collections.Generic.List[System.Object]
$Exc.Add('Subscription')
$Exc.Add('Resource Group')
$Exc.Add('Name')
$Exc.Add('Location')
$Exc.Add('VNET')
$Exc.Add('Subnet')
$Exc.Add('Private Link Name')
$Exc.Add('IP Address')
$Exc.Add('FQDN')
$Exc.Add('Private Link Status')
$Exc.Add('Private Link Resource Type')
$Exc.Add('Private Link Target Resource')
if($InTag)
{
$Exc.Add('Tag Name')
$Exc.Add('Tag Value')
}

$ExcelVar = $SmaResources.PrivateEndpoint

$ExcelVar |
ForEach-Object { [PSCustomObject]$_ } | Select-Object -Unique $Exc |
Export-Excel -Path $File -WorksheetName 'PvtEndpoint' -AutoSize -MaxAutoSizeRows 100 -TableName $TableName -ConditionalText $condtxt -TableStyle $tableStyle -Style $Style

}
}

0 comments on commit ef5194a

Please sign in to comment.