Friday, April 24, 2015

Find out Exchange or NSP Exchage Route providers in Azure PowerShell

########check if there is an active azure account#########

function Handle-AzureAccount () {

    try {

        $val=Test-AzureName –Service "MyNameService1" -errorvariable MyErr -erroraction Stop

    } catch {

        Add-AzureAccount

    }

}

 

########end check if there is an active azure account#########

 

 

Import-Module 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1'

Import-Module 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\ExpressRoute\ExpressRoute.psd1'

 

Handle-AzureAccount

 

$providers=Get-AzureDedicatedCircuitServiceProvider

 

#NSP providers Type="Telco" or Exchange providers Type="IXP"

for ($count=0; $count -lt $providers.Count; $count++){

    if ($providers[$count].Type -eq "Telco") {

        Write-Host "Name:" $providers[$count].Name

        Write-Host "Locations:" $providers[$count].DedicatedCircuitLocations

        $bandwidths=$providers[$count].DedicatedCircuitBandwidths

        for ($bdthCount=0;$bdthCount -lt $bandwidths.Count; $bdthCount++){

            Write-Host "Label:" $bandwidths[$bdthCount].Label "Bandwidth:" $bandwidths[$bdthCount].Bandwidth

        }

     }

}

 

No comments:

Post a Comment