Azure Resource Capacity - Network

This SAM template contains statistics counters for monitoring Azure Compute and Network Resources. 

Note: This template was updated on April 1, 2020, to update to the calling the requests via API. It also added more core types from the previous version.


  • PowerShell is not needed.
  • To connect with the Azure account, you'll need the TenantId, SubcriptionID ApplicationID, TenantID, and Secret Key.  Any Azure App (with its name and ID) with minimum role of 'Read Only' on the Subscription.
  • Custom Properties
    • SubscriptionID
    • TenantID
  • Credentials
    • Create a new Credential with AppID Name (for convenience)
      • UserName = <ApplicationId>
      • Password = <Secret Value>


·         The ApplicationID with which you are connecting to Azure portal must be registered in Azure Active Directory as reader role for the monitored subscription.

·         For reference, see Add an Azure Active Directory app for cloud monitoring in the Orion Platform.

On-boarding Template:

Before we can start gathering the appropriate data per region, we need to put the regions into the template.  In order to do this we need to test the script to provide the answers – to an extent.  There is a limitation of 10 areas that can be pulled in.  If you have need to pull from more, please contact me or update the script to look at the first 10 regions and duplicate the template and do it for the next 10 and so on.

  • In Application Monitor Templates, choose the Template to update (you by default have 2 that you will need to do this to) and select Edit.
  • You will notice that there are no Custom Properties to fill out, we need to add the Tenant ID and Subscription ID to each of the Components you may be monitoring.
  • For each Component your Subscription has data for (it only returns if the number actually live is greater than 0) enable the component.
  • Expand the component so you see all the settings.  Select Edit Script.
    1. In Script Arguments make sure you add to the Resource Name “,<TenantId>,<SubscriptionID>” (minus the quotes).
    2. Will Run against is one of your Windows Nodes.
    3. Credential will be the Friendly Name of your Application ID you created in the Prerequisites.
    4. Choose Get Script Output.
  • When the Output Results return – hopefully there is data, if not try another resource – click Save.
  • You need to remove the “,TenantID, SubscriptionID” you entered in Step 4a from the Script Arguments, Convert Credential Monitoring back to None (unless you only have one AppID) and if you typically don’t have this component enabled – disable the component.  Update your Warning and Critical Thresholds (number is %) and click Save and Continue Working.
  • Move onto the next component as needed.  Start with Step 4.
  • Once the template is complete click Submit. Move onto the next Template or move onto On-Boarding Subscription.  

On-boarding Subscription:

  • Import templates:  Azure Resource Capacity – Compute, Azure Resource Capacity – Network
  • Select one or both templates and “Assign to Node”
    1. <orionserver>/Orion/APM/Admin/ApplicationTemplates.aspx
  • Select one of your Windows nodes to run against
  • Assign custom credential:  Use the new Credential you created in Prerequisites
    1. If you are prompted for assign duplicates, choose “Yes, Assign Anyway” – this is important if you monitor more than one subscription.
  • Edit each of the templates you selected in Step 2.
    1. Rename the Application Monitor Name to something unique (I use the friendly Subscription Name)
    2. Put your SubscriptionID in the Custom Property
    3. Put your TenantID in the Custom Property
    4. Make any other changes to the defaults (have set to 1-hour frequency and timeout of 5 minutes).
    5. Unless you know the components you want to monitor choose Check Box under Multi Edit and Enable all.  Run a Test.
      1.       For those that return “Test failed with “Unknown” status…” disable the component.
      2.       For those that returned with another failure, we will need to add the result to the component.  Please see Onboarding Template on steps to do this.
    6. Either Assign More and repeat from Step 2 or Done.


  • Azure Resource Capacity Type (<capacitytype>). E.g. Total Regional vCPUs – This is already predefined for the current supported ones.
  • Optional parameters can be passed to script argument:
    • <TenantId> = Used for defining the Output Results on the default template
    • <SubscriptionId = Used for defining the Output Results on the default template
    • Number of retries as the second last argument; the default is 3.
    • WaitTime as the last argument; the default is 1 seconds


Note:  Each resource is a Licensed Component in SAM.

  1. Typical needs include Virtual Networks, Public IP Address.
  2. Expanded needs may include Network Security Groups, Route Tables, Load Balancers, etc.


Detail troubleshooting steps (common for template)

  • Only see one of my subscriptions with resource X.
    • Make sure when you onboard the subscription, you choose “Yes, Assign Anyway”.
  • Components connect with azure using service principal authentication for which application must be created at azure portal see below link:

  • Provide Azure IAM permission to the application which is created in above point see below link:

Detail troubleshooting steps (specific for components)

  • “Test failed with “Unknown” status on <<Node>>”
    • The allocated number of resources for this resource is 0.  If the resource will not have additional assets, then disable the monitor.  Opposite of this as this does not automatically identify new assets you need to manually enable on resources that are now in the subscription that were not there when you deployed.
  • “Test failed with “Unknown” status… Output:  Message… Statistic…”
    • A new region has shown up on this component.  You will need to On-board Template to add a new region.  It will then be picked up by all subscriptions.