April 6th, 2020

Integrating Support cases into your DevOps process with the Azure Support API

Developer Support
Cloud Solution Architects

App Dev Manager Rick Caudle explores how to integrate support cases into your DevOps process using the Azure Support API.


So you have a fairly mature DevOps model in-place but you are missing the ability to integrate Azure Support issues into your processes. Well, that is no longer the case as we have released to the public our Azure Support Ticket REST API. More details about the API can be found by clicking this link.

The API allows you to:

  • Open a technical, billing, subscription management, or quota increase support ticket.
  • Get a list of support tickets and detailed information about each ticket. Narrow your search for support tickets by status or created date.
  • Update severity, and contact information for a support ticket.
  • Add a new communication to a support ticket or get a list of all communications for a support ticket. Narrow your search of communication lists by created date or communication type.

In this post, I am going to provide you with a simple example of the API in action. The idea is demonstrate how simple it is to use and from this and the API documentation you can best determine how you might integrate this into your DevOps process to improve operational efficiency.

Let’s get started!

What needs to happen prior making any calls to the API?

  1. Log into the Azure Portal and select the subscription that will be used with the API
  2. Open the “Resource Providers” and search for microsoft.support and register it (this is a requirement in order to use the API)

Once this is completed you are ready to make use of the API!

Prerequisites required before using the example below

  1. Install Python 3.8.2 for Windows
  2. Install the Azure CLI

Quick example of opening a support ticket

In this example I will be using Python 3.8.2 for Windows as well as the Azure CLI. As of 3/18/2020 the availability of examples is sparse, but there are plans to have the documentation updated by April timeframe.

  1. Open the Azure CLI and type the following:
    az extension add --name support
  2. To leverage the support extension/API we need to first authenticate to Azure by running the following command from the CLI:
    az login
  3. Now, we need to verify that the support extension was successfully installed and working. Type the following command into the Azure CLI:
    az support services list

    If the support extension was properly installed and is working you it will results like the following:

    [
      {
        "displayName": "Activity Logs",
        "id": "/providers/Microsoft.Support/services/484e2236-bc6d-b1bb-76d2-7d09278cf9ea",
        "name": "484e2236-bc6d-b1bb-76d2-7d09278cf9ea",
        "resourceTypes": [],
        "type": "Microsoft.Support/services"
      },
      {
        "displayName": "Advanced Threat Protection - Azure",
        "id": "/providers/Microsoft.Support/services/809e8afe-489e-08b0-95f2-08f835a383e8",
        "name": "809e8afe-489e-08b0-95f2-08f835a383e8",
        "resourceTypes": [],
        "type": "Microsoft.Support/services"
      },
    
  4. Next, we need to determine which service we would like to create a support ticket for. Review the results for step 3 and identify which service you would like to use. For this example, I will be using:
    {
        "displayName": "Virtual Machine running Windows",
        "id": "/providers/Microsoft.Support/services/6f16735c-b0ae-b275-ad3a-03479cfa1396",
        "name": "6f16735c-b0ae-b275-ad3a-03479cfa1396",
        "resourceTypes": [
          "MICROSOFT.CLASSICCOMPUTE/VIRTUALMACHINES",
          "MICROSOFT.COMPUTE/VIRTUALMACHINES"
        ],
        "type": "Microsoft.Support/services"
      }
    
  5. Make note of “name”: “6f16735c-b0ae-b275-ad3a-03479cfa1396” in step 4 as we will need this to enumerate the problem classifications that are available for this service
  6. Next, we need to call the problems classification API to determine how to classify the type of support case we are opening. We do this by calling the services problem classification list API.
    az support services problem-classifications list --service-name "6f16735c-b0ae-b275-ad3a-03479cfa1396"

    Please note that I passed the GUID from step 5 via the –service-name.

  7. The command executed in step 6 will return all the classifications available for the service, we need to pick one. In this example I am going to use the following:
    {
        "displayName": "Cannot connect to my VM / Troubleshoot my network security group (NSG)",
        "id": "/providers/Microsoft.Support/services/6f16735c-b0ae-b275-ad3a-03479cfa1396/problemClassifications/9e9faedb-7764-448b-244a-14eca26f5362",
        "name": "9e9faedb-7764-448b-244a-14eca26f5362",
        "type": "Microsoft.Support/problemClassifications"
      }
    
  8. The item we need from the above is:
    "/providers/Microsoft.Support/services/6f16735c-b0ae-b275-ad3a-03479cfa1396/problemClassifications/9e9faedb-7764-448b-244a-14eca26f5362"
  9. Now, we have everything we need to successfully create the support ticket using the Azure Support API. Here is the command we need to execute as well as all the parameters that need to be provided in order for the call to succeed:
    az support tickets create --ticket-name "TechnicalTest2TicketName" --problem-classification "/providers/Microsoft.Support/services/6f16735c-b0ae-b275-ad3a-03479cfa1396/problemClassifications/9e9faedb-7764-448b-244a-14eca26f5362" --title "TechnicalTicketTitle" --description "TechnicalTicketDescription" --severity "minimal" --contact-first-name "Foo" --contact-last-name "Bar" --contact-method "email" --contact-email "abc@contoso.com" --contact-timezone "Pacific Standard Time" --contact-country "USA" --contact-language "en-US"

    If the support case was created a JSON response will be returned. Here is a snippet of the response that was returned for my example:

"supportPlanType": "Premier",
  "supportTicketId": "120031824005544",
  "technicalTicketDetails": null,
  "title": "TechnicalTicketTitle",
  "type": "Microsoft.Support/supportTickets"
} 

Important Notes

The problem-classification-id must be correct for the support creation to succeed. Run the az support services problem-classifications list command to enumerate the classifications (see step 6). Also, the name provided for –ticket-name parameter must be unique. If you try to running the command twice it will fail the 2nd time because there is already a support ticket with the same name.

Additional Details

We also provide support for the API via PowerShell as well, more can be found on the GitHub repo by clicking here. We will also be releasing a C# SDK for the Azure Support API which we plan to release in the April timeframe.

Author

Developer Support
Cloud Solution Architects

Microsoft Developer Support helps software developers rapidly build and deploy quality applications for Microsoft platforms.

0 comments

Discussion are closed.