Implemented getting the resources

This commit is contained in:
Jurjen Ladenius
2021-08-18 12:36:53 +02:00
parent 31f3acdd3b
commit 05b9ce94a6
5 changed files with 133 additions and 107 deletions

View File

@@ -31,27 +31,27 @@ function Get-EffectoryDomainResources {
# ------------------------------------------------------------------------------------------------------------------
Write-Host "Checking WebApps and WebApp Slots for subscription $($currentContext.Name)"
# $webApps = Get-AzWebApp
# [int]$webAppCounter = 0
# [int]$webAppSlotCounter = 0
$webApps = Get-AzWebApp
[int]$webAppCounter = 0
[int]$webAppSlotCounter = 0
# if ($null -ne $webApps) {
# # check webapps
# $itemsWebApps = CheckWebApps -subscription $currentContext -webApps $webApps -effectoryDomainPattern $effectoryDomainPattern
# $webAppCounter += $itemsWebApps.Count
# $result += $itemsWebApps
if ($null -ne $webApps) {
# check webapps
$itemsWebApps = CheckWebApps -subscription $currentContext -webApps $webApps -effectoryDomainPattern $effectoryDomainPattern
$webAppCounter += $itemsWebApps.Count
$result += $itemsWebApps
# # check webapp slots
# foreach ($webApp in $webApps) {
# $slot = Get-AzWebAppSlot -WebApp $webApp
# if ($null -ne $slot) {
# $itemsWebAppSlots = CheckWebApps -subscription $currentContext -webApps $slot -effectoryDomainPattern $effectoryDomainPattern
# $webAppSlotCounter += $itemsWebAppSlots.Count
# $result += $itemsWebAppSlots
# }
# }
# }
# Write-Host "Found $($webAppCounter) WebApps and $($webAppSlotsCounter) WebApp Slots for subscription $($currentContext.Name)"
# check webapp slots
foreach ($webApp in $webApps) {
$slot = Get-AzWebAppSlot -WebApp $webApp
if ($null -ne $slot) {
$itemsWebAppSlots = CheckWebApps -subscription $currentContext -webApps $slot -effectoryDomainPattern $effectoryDomainPattern
$webAppSlotCounter += $itemsWebAppSlots.Count
$result += $itemsWebAppSlots
}
}
}
Write-Host "Found $($webAppCounter) WebApps and $($webAppSlotsCounter) WebApp Slots for subscription $($currentContext.Name)"
# ------------------------------------------------------------------------------------------------------------------
Write-Host "Checking FrontDoor Endpoints for subscription $($currentContext.Name)"
@@ -89,9 +89,46 @@ function Get-EffectoryDomainResources {
}
Write-Host "Found $($cdnCounter) Cdn Endpoints for subscription $($currentContext.Name)"
# ------------------------------------------------------------------------------------------------------------------
Write-Host "Checking public IP addresses for subscription $($currentContext.Name)"
$ipAddresses = Get-AzPublicIpAddress | Where-Object DnsSettings -ne $null | Where-Object { $_.DnsSettings.DomainNameLabel -ne "" }
[int]$ipCounter = 0
if ($null -ne $ipAddresses) {
$itemsIpAddresses = CheckIpAddresses -subscription $currentContext -ipAddresses $ipAddresses -effectoryDomainPattern $effectoryDomainPattern
$ipCounter += $itemsIpAddresses.Count
$result += $itemsIpAddresses
}
Write-Host "Found $($ipCounter) public IP addresses for subscription $($currentContext.Name)"
# ------------------------------------------------------------------------------------------------------------------
Write-Host "Checking Traffic Managers for subscription $($currentContext.Name)"
$trafficManagers = Get-AzTrafficManagerProfile
[int]$trafficManagerCounter = 0
if ($null -ne $trafficManagers) {
$itemsTrafficManagers = CheckTrafficManagers -subscription $currentContext -trafficManagers $trafficManagers -effectoryDomainPattern $effectoryDomainPattern
$trafficManagerCounter += $itemsTrafficManagers.Count
$result += $itemsTrafficManagers
}
Write-Host "Found $($trafficManagerCounter) Traffic Managers for subscription $($currentContext.Name)"
# ------------------------------------------------------------------------------------------------------------------
Write-Host "Checking Container groups for subscription $($currentContext.Name)"
$containerInstances = Get-AzContainerGroup
if ($null -ne $containerInstances) {
throw "Container groups are not implemented yet."
}
# ------------------------------------------------------------------------------------------------------------------
Write-Host "Checking API Management for subscription $($currentContext.Name)"
$apiManagementServices = Get-AzApiManagement
if ($null -ne $apiManagementServices) {
throw "API Management services are not implemented yet."
}
# ------------------------------------------------------------------------------------------------------------------
$result
}
}