Tag Archives: Azure

Using Azure OpenAI and Logic Apps to Triage Bugs in Azure DevOps

There are other examples out there using the publicly-available OpenAI service, but what if you’re concerned about “pulling a Samsung” and inadvertently sending your company’s IP to the public service when trying to triage a bug report? A simple error message can accidentally provide context about what you’re working on, such as project names, file types, method names, and any other context you intend to use in your prompt.

OpenAI is an AI research lab and company known for their advanced language model GPT-3, while the Azure OpenAI Service is a specific offering within Microsoft Azure that integrates OpenAI’s technologies into the Azure platform, allowing developers to leverage their powerful AI models at scale. Azure OpenAI (AOAI) also helps keep your company’s data in your own Azure tenant.

In my little sample implementation, I used AOAI, a Logic App, and a small Azure Function to put together an “automatic AI bug triage” service hooked up to Azure DevOps. This approach provides a simple way to send problem information to OpenAI for the sake of solving a bug, without training the public OpenAI model.

First, get yourself access to the Azure OpenAI service by requesting it here.

Once you have your service provisioned, you’ll be ready to connect to it from your Azure Function (more on that shortly).

Azure Logic App

The scaffolding for this triage service is the Azure Logic App, which helps orchestrate the capturing of the bug submission, calling the Function, and putting the results back into the bug in Azure DevOps.

Below, you see the first steps of the Logic App. It’s triggered when a bug is created in Azure DevOps (you must specify your org and project for scope, an provide other conditions to trigger if you like), capture the value from the “Repro Steps” field. The value is then “scrubbed” to plain text.

First steps of the Azure Logic App
First steps of the Azure Logic App

Next, we call the TriageBug Azure Function and pass it the value of the ‘reprostep’s variable. After capturing the response from the Function in a variable ‘triagetext’, that value is updated into the original bug (work item). In this example, I put it in a custom “AI Triage” field.

Final steps of Azure Logic App
Final steps of Azure Logic App

Azure Function to Call Azure Open AI

Now, I could have skipped using a Function and just called the AOAI service directly via its REST endpoint, but why not modularize that a little, providing more development control over prompting (or prompt chaining) to hopefully a more accurate response from the service.

In my Function I used the Microsoft Semantic Kernel, which is a lightweight SDK which provides easy access to AOAI. An easy method to get an IKernal object:

  private static IKernel GetSemanticKernel()
  {
      var kernel = Kernel.Builder.Build();
      kernel.Config.AddAzureTextCompletionService(
          _OpenAIDeploymentName,
          _OpenAIEndpoint,
          _OpenAIKey
      );
      return kernel;
  }

You can, for example purposes, hard code the above ‘_OpenAIDeploymentName’, ‘_OpenAIEndpoint’, and ‘_OpenAIKey’ variables, but it’s recommended you pull those values from Key Vault.

I create a quick static method to call AOAI. I hard-coded the prompt to send to the service, but you could easily extend it to pull a prompt from somewhere else:

        static async Task<string> AskForHelp(string msg)
        {
            IKernel kernel = GetSemanticKernel();

            var prompt = @"As a software developer, identify potential causes, fixes, and recommendations 
for the following error message (include references as well): {{$input}}";

            var fnc = kernel.CreateSemanticFunction(prompt);

            var result = await fnc.InvokeAsync(msg);
            return result.ToString();

        }

The Function trigger was only a small edit from the base code created when using an HTTP trigger:

public static async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
    ILogger log)
{
    log.LogInformation("TriageBug function processed a request.");

    string message = req.Query["message"];

    string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
    dynamic data = JsonConvert.DeserializeObject(requestBody);
    message ??= data?.message;

    string responseMessage = await AskForHelp(message);

    return new OkObjectResult(responseMessage.Trim());
}

If I have the Logic App enabled and file a bug in ADO, the Logic App runs and I see something like this:

AI triage of bug in ADO
AI triage of bug in ADO

So there you go!

Is it perfect? Nope. There are plenty of things you can adjust/add here to make this more robust, such as:

  • Use more AI to “learn” what best prompt to use (based on extracted text) to get more accurate results.
  • Return the triage text as HTML to enable hyperlinks and better formatting.
  • Uh.. maybe a little error handling? 😀
  • Use more values from ADO (additional bug field values, project name, description, etc) to provide better context for the prompt.

I’m sure there are more. Hopefully this gets you started!

Webinar: Optimize Costs with Application Modernization

Today more than ever, Healthcare companies are looking to lower cost and speed up innovation through the lens of their applications.  Microsoft has created a team to help support this complex and time-consuming process of analyzing ALL the components of the application AND the hardware it’s running on, to provide a comprehensive recommendation and plan for a single application to an entire company’s portfolio of applications.

Join us in this webinar to learn about:​

  • State of Healthcare application landscape
  • Application focused assessment that helps deliver financial, and a technical business case for each application
  • Programs and resources available to help accelerate modernization
  • Real-world success stories leveraging the Application Modernization Assessment

How to engage directly with a Microsoft Application Innovation Specialist

WHEN: Wed, 12/14, 2022, 9:30AM PST

Register here

Key App Innovation Announcements at Ignite 2022

Did you make it to Ignite 2022? Yes? No?

Either way, I’ve put together some links to key sessions and announcements from the conference.

Key Announcements

Ignite 2022 came with a slew of announcements in areas of development and innovation. My highlights include:

(You can read about all of the announcements from Ignite in the Ignite 2022 Book of News)

On-Demand Sessions

Application Modernization

Cloud-Native

Low/No Code

Developer Tools

I (or others on my team) would be happy to walk through some of these announcements in more detail with you and your team!

So what was your favorite session?

Stretching your Dev/Test Dollar in Azure

Visual Studio Subscriptions, Dev/Test Subscriptions & More

You’ve got needs. Dev/Test needs. And access to an infinite world of power with Azure. How can you leverage that cloudly frontier for non-production work, i.e. Dev/Test?

There are typically two main scenarios when talking about Dev/Test in the cloud:

  • You want a sandbox to play in that won’t cost much or impact others. A place that you can use to try new things, spin up new services, and learn.
  • You need a shared sandbox for collaborative work (but not production), for trying new concepts or architectures, or simply don’t want to pay production prices for non-production environments.

In the basic sense, there are two options to best leverage your dollars in Azure for Dev/Test: Visual Studio Subscriptions (if you own them) and their Azure credit benefit, and the Enterprise Dev/Test Subscriptions (in Azure, not to be confused with a VS Subscription). Let’s take a walk through both approaches.

Visual Studio Subscriptions – Azure Credits Benefit

Your Visual Studio Subscription comes with monthly credits in Azure to use against your own, individual, Azure Subscription. Depending on your flavor of Visual Studio, you get different amounts of credits ($50/$100/$150), which reset monthly (this means that if you go over your credit limit, your resources simply shut off until your billing period restarts.

Monthly Azure credits as part of your Visual Studio Subscription benefit

If you haven’t already done so, you can activate your monthly credit benefit at https://my.visualstudio.com/. (see below)

https://my.visualstudio.com/

This monthly benefit gives you access to most Azure services for learning and speculative individual development, without bothering anyone.

  • Individual skills development
  • Experimenting in Azure
  • Light individual dev/test workloads
  • Prototyping, POC’s, “throw-away work”

That said, some organizations I’ve worked with in the past don’t like/allow these Visual Studio-based Azure subscriptions as they don’t initially have as much control. So, it’s best to check with your IT team, and your Visual Studio Subscriptions administrator (how to find/contact).

Enterprise Dev/Test Subscription (Azure)

If you have an Enterprise Agreement with Microsoft, the Enterprise Dev/Test Subscription may be a great option for you if you have Visual Studio Subscribers that want/need to collaborate in Azure in a non-prod environment.

At a high-level, the Enterprise Dev/Test Offer is:

  • For non-production workloads in Azure
  • Special, lower rates on Windows VMs, cloud services, SQL, HDInsight, App Service, Logic Apps. (Additional savings with Reservations)
  • Access to Dev/Test images (incl. Win 8.1/10)
  • Centralized management via Azure Enterprise Portal
  • Use funds on Enterprise Agreement/MACC (or PAYGO use Dev/Test Offer)

That said, it’s important to make a distinction between the Enterprise Dev/Test Azure subscription and a standard Enterprise Azure subscription:

Enterprise Dev/TestStandard Enterprise
Restricted to dev/test usage only
Can only be used by active VS subscribers
Includes dev/test images (Win 8.1 & 10)
Not covered by SLAs
Any/all workloads
Covered by SLAs

Main differences between Enterprise Dev/Test & standard Enterprise

Critical points for a Dev/Test subscription:

  • There is no financially-backed SLA
  • Any and all users of a Dev/Test subscription MUST have Visual Studio Subscriptions.

Sound like a good option? Your Azure Account Owner (w/ permission to do so from an Enterprise Administrator) can create a Dev/Test subscription for you.

Where do each fit in?

Let’s build this out visually.

Individual developer, learning, prototyping? Use the Azure credits as part of your Visual Studio Subscription.

Need to collaborate with your broader team in a non-prod environment? Go the Enterprise Dev/Test route.

Production workloads? Use your standard Enterprise Subscription (don’t forget your AHUB benefits to minimize costs!).

For further reading: