Creating a Unit monitor which calls Azure via Powershell RRS feed

  • Question

  • I can run a command in powershell that lists my resources as so :

    Get-AzureRmResource -ResourceId ...

    And the output can have various values

    provisioningState": "Succeeded|Failed|Cancelled", circuitProvisioningState": "Enabled|Disabled|Enabling|Disabling", serviceProviderProvisioningState": "NotProvisioned|Provisioning|Provisioned|Deprovisioning", serviceProviderProperties": { serviceProviderName": "serviceProviderName", peeringLocation": "<peering location", bandwidthInMbps": 100

    I would like my monitor to check the status of 'provisioningState' and if its Suceeded then be 'Healthy and anything else then be a critical Alert.

    Could someone help point in the right direction on how to achieve pls ?

    Thursday, December 1, 2016 1:49 PM

All replies

  • Hi Sir,

    $api = New-Object -comObject “MOM.ScriptAPI”  
    $PropertyBag = $api.CreatePropertyBag()
    $provisioningState = (Get-AzureRmResource -ResourceId xxxx ).provisioningState

    Then you may select the expression "Property[@Name=”provisioningState”]" equal/not equal "Succeeded".

    It is similar with following article:


    Hope it is helpful to you .

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Proposed as answer by Elton_Ji Friday, January 6, 2017 10:19 AM
    Monday, December 5, 2016 11:03 AM