PowerShell: Azure Traffic Manager Profiles with Endpoint details
Here is a PowerShell snippet to query Azure Traffic Managers with endpoint details. The script uses PowerShell Az modules so that it is compatible with both Standard PowerShell and PowerShell Core. The script uses the Azure Resource Graph query to get the resource details. $ trafficManagerQuery = " where type =~ 'microsoft.network/trafficmanagerprofiles' " $ trafficeManagers = Search-AzGraph - Query $ trafficManagerQuery $ resultTM = @ () foreach ($ tm in $ trafficeManagers ) { $ endPoints = $ tm.properties.endpoints foreach ($ endPoint in $ endPoints ) { $ edTagetQuery = " where id =~ '{0}' " -f $ endPoint.properties.targetResourceId $ endTarget = Search-AzGraph - Query $ edTagetQuery $ customObjProperties = [ ordered ] @ { ' Name ' = $ tm.name ' Status ' = $ tm.properties.profileStatus