Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $resources = Find-AzureRmResource
- Write-Verbose -Verbose "Processing information..."
- 'CloudType;Type' | out-file -FilePath C:\AzureTypesTMP.csv
- $all = foreach ($item in $resources)
- {
- $cloudtype = $item.Name.Substring(0,7)
- $types = $item.Name.Substring(4,3)
- Switch ($types)
- {
- ASE { $realtype = "Application Service Environment"; break }
- API { $realtype = "API Service"; break }
- ASP { $realtype = "App Service plan"; break }
- CSE { $realtype = "Cognitive Services"; break }
- EHB { $realtype = "Event Hub"; break }
- HUB { $realtype = "Event Hub"; break }
- FUA { $realtype = "Function App"; break }
- LOG { $realtype = "Logic app"; break }
- NSG { $realtype = "Network security group"; break }
- SAJ { $realtype = "Stream Analytics job"; break }
- SBU { $realtype = "Service Bus"; break }
- sse { $realtype = "Search service"; break }
- ssr { $realtype = "SQL server"; break }
- EPD { $realtype = "SQL elastic pool"; break }
- SDB { $realtype = "SQL database"; break }
- EDP { $realtype = "SQL elastic pool"; break }
- sta { $realtype = "Storage account"; break }
- VNW { $realtype = "Virtual network"; break }
- WEB { $realtype = "App Service"; break }
- Default { "Not detected" }
- }
- if ($cloudtype.startswith("mscsta"))
- {
- $realtype = "Storage account"
- }
- $cloudtype + ";" + $realtype | out-file -FilePath C:\AzureTypesTMP.csv -Append
- $input = 'C:\AzureTypesTMP.csv'
- $inputCsv = Import-Csv $input | Sort-Object * -Unique
- $inputCsv | Export-Csv "C:\AzureTypes.csv" -NoTypeInformation
- Remove-Item C:\AzureTypesTMP.csv -Force
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement