This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs - Feed.
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.
What needs to happen prior making any calls to the API?
- Log into the Azure Portal and select the subscription that will be used with the API
- Open the “Resource Providers” and search for microsoft.support and register it (this is a requirement in order to use the API)
Prerequisites required before using the example below
- Install Python 3.8.2 for Windows
- 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.- Open the Azure CLI and type the following:
az extension add --name support
- To leverage the support extension/API we need to first authenticate to Azure by running the following command from the CLI:
az login
- 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" },
- 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" }
- 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
- 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. - 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" }
- The item we need from the above is:
"/providers/Microsoft.Support/services/6f16735c-b0ae-b275-ad3a-03479cfa1396/problemClassifications/9e9faedb-7764-448b-244a-14eca26f5362"
- 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" }