Microsoft Copilot for Azure (preview): Write and optimize code

0
612

What is Microsoft Copilot for Azure (preview)?

An AI-powered product called Microsoft Copilot for Azure (preview) can help you get more out of Azure. You may orchestrate between cloud and edge with Microsoft Copilot for Azure (preview), learn more about the advantages of the cloud, and obtain fresh insights. To help you work more productively, Copilot makes use of Large Language Models (LLMs), the Azure control plane, and insights about your Azure environment.

You can find your way across Azure’s thousands of resource types and hundreds of services with the aid of Microsoft Copilot for Azure (preview). It provides deep insights, lowers expenses, and boosts productivity by combining knowledge and data from hundreds of providers. By providing answers to queries, Microsoft Copilot for Azure (preview) can assist you in learning more about Azure and can offer information specific to your particular Azure setup and resources. Azure administration can be made easier with Microsoft Copilot for Azure (preview), which allows you to articulate your objectives in plain terms.

Via the Azure portal, Microsoft Copilot for Azure is available. Microsoft Copilot for Azure (preview) answers inquiries, creates queries, completes tasks, and acts securely on your behalf throughout a discussion. It respects the privacy and policies of your firm while making excellent recommendations and taking appropriate action.

In this blog post, let’s take a look at how Microsoft Copilot for Azure (preview) can be especially helpful for writing and optimizing code.

Generate Azure CLI scripts

Azure CLI scripts that you can use to create or manage resources can be generated by Microsoft Copilot for Azure (preview).

Upon informing Microsoft Copilot for Azure (preview) of an Azure CLI task you wish to do, it generates a script with the required commands. Based on your surroundings, you’ll be able to identify the placeholder values you need to alter with the real ones.

The prompt types that you can use to create Azure CLI scripts are shown in the following examples. Adapt these prompts to your own real-world situations, or experiment with other prompts to generate new types of questions.

  • “I want to create a virtual machine using Azure CLI”
  • “I want to use Azure CLI to deploy and manage AKS using a private service endpoint”
  • “I want to create a web app using Azure CLI”

The prompt “I want to use Azure CLI to create a web application” in this example gives the required Azure CLI commands along with a list of stages to follow.

Saying “I want to create a virtual machine using Azure cli” will also result in a step-by-step command guidance.

Said another way, “I want to use Azure CLI to deploy and manage AKS using a private service endpoint.” is a more thorough scenario.

Discover performance recommendations with Code Optimizations

Code optimizations for Application Insights resources with an active Application Insights Profiler are available with Microsoft Copilot for Azure (preview). This enables you to see suggestions made specifically for your app to improve its functionality.

Microsoft Copilot for Azure (preview) automatically gathers context from an open Application Insights blade or App Service blade to display available recommendations tailored to that application when you ask it to provide these recommendations. You’ll be prompted to select an Application Insights resource from a resource selector page if the context is unclear.

The types of prompts you can use with Code Optimizations are shown here in a few examples. Adapt these questions to your actual experiences, or experiment with different questions about particular areas that could use improvement.

  • “Show my code performance recommendations”
  • “Any available app code optimizations?”
  • “Code optimizations in my app”
  • “My app code is running slow”
  • “Make my app faster with a code change”

The response of Microsoft Copilot for Azure (preview) to the question “Any code performance optimizations?” is shown in this example. There are six recommendations listed in the response, and users can choose to view all of the recommendations at once or just the top recommendation.

All of the recommendations are shown in Microsoft Copilot for Azure (preview) when the Review all option is chosen. After that, you can click on any suggestion to view more information.

Author API Management policies

Azure API Management policies can be created by Microsoft Copilot for Azure (preview) in accordance with your specifications. Even if you’re not sure what code you need, you can quickly create policies by using Microsoft Copilot for Azure (preview). This is particularly useful when drafting intricate policies with numerous requirements.

Start at the Design tab of an API that you have previously imported into your API Management instance to receive assistance in authoring API Management policies. Use the code editor view, please. Request that Microsoft Copilot for Azure (preview) create policy definitions for you. Copy the results into the editor and make the necessary modifications. In order to modify the offered policy or better understand your options, you can also ask questions.

You can also select a section of an API Management policy, perform a right-click, and choose Explain when working with such policies. This will launch Microsoft Copilot for Azure (preview) and prompt you to explain how that particular policy section functions after you paste your selection.

You can use the following types of prompts to get assistance when creating API Management policies. Adapt these prompts to your actual situations, or experiment with other prompts to generate various policy types.

  • “Generate a policy to configure rate limiting with 5 requests per second”
  • “Generate a policy to remove a ‘X-AspNet-Version’ header from the response”
  • “Explain (selected policy or element) to me”

To create an API Management policy, you can use the syntax “Generate a policy to configure rate limiting with 5 requests per second.” An example is given by Microsoft Copilot for Azure (preview), along with an explanation of how you might want to alter the provided depending on your needs.

This example shows how to create a policy in response to the prompt, “Generate a policy to remove a ‘X-AspNet-Version’ header from the response.”

To find out more information about a particular policy element, select the section of the policy that interests you, then right-click and choose Explain.

Microsoft Copilot for Azure (preview) breaks down each individual section of the code to explain how it works.

Generate Kubernetes YAML files

You can apply Kubernetes YAML files to your Azure Kubernetes Service (AKS) cluster using Microsoft Copilot for Azure (preview).

You supply the requirements for your application, including networking preferences, resource requirements, and container images. By encapsulating the infrastructure as code, Microsoft Copilot for Azure (preview) uses your input to generate comprehensive YAML files that specify the desired Kubernetes deployments, services, and other resources. Best practices are followed in the generation of YAML files, which makes managing and deploying containerized applications on AKS easier. As a result, you can concentrate more on your apps and less on the supporting infrastructure.

These are some examples of the different prompt types that you can use to create YAML files for Kubernetes. Adapt these prompts to your actual situations, or experiment with other prompts to generate various types of Kubernetes YAML files.

  • “Help me generate a Kubernetes YAML file for a “frontend” service using port 8080″
  • “Give me an example YAML manifest for a CronJob that runs every day at midnight and calls a container named nightlyjob”
  • “Generate a Kubernetes Deployment YAML file for a web application named ‘my-web-app’. It should run three replicas and expose port 80.”
  • “Generate a Kubernetes Ingress YAML file that routes traffic to my frontend and backend services based on hostnames.”

Here, a YAML file is created by Microsoft Copilot for Azure (preview) in response to the request, “Help me generate a Kubernetes YAML file for a “frontend” service using port 8080.”

Troubleshoot your apps faster with App Service

For diagnostics and solutions related to Azure App Service, Microsoft Copilot for Azure (preview) can serve as your go-to expert.

App Service provides over sixty debugging tools to address various kinds of problems. Alternatively, you can ask Microsoft Copilot for Azure (preview) about the issue you’re having rather than trying to figure out which tool to use. Whichever tool is most appropriate for your question—whether it has to do with excessive CPU usage, networking problems, obtaining a memory dump, or anything else—will be determined by Microsoft Copilot for Azure (preview). You’ll be able to fix any issues you’re having with the assistance of pertinent diagnostics.

Depending on the app you’re viewing in the Azure portal or the current conversation, Microsoft Copilot for Azure (preview) automatically pulls context when you ask for assistance with App Service troubleshooting. You will be asked to identify the resource for which you would like information if the context is unclear.

The following are a few types of prompts that you can use to get assistance when troubleshooting App Service. Adapt these prompts to your own real-world situations, or experiment with other prompts to receive assistance with various kinds of problems.

  • “My web app is down”
  • “My web app is slow”
  • “Enable auto heal”
  • “Take a memory dump”

With Microsoft Copilot for Azure (preview), you can report “my web app is down.” Microsoft Copilot for Azure opens the App Service – Web App Down tool so you can view diagnostics after you select the resource that needs troubleshooting.

Say “Take a memory dump” to Microsoft Copilot for Azure (preview), and it will recommend launching the Collect a Memory Dump tool to capture a snapshot of the current state of the application. In this case, the resource chosen earlier in the discussion is still being used by Microsoft Copilot for Azure (preview).

Current limitations

Even though Microsoft Copilot for Azure (preview) is capable of a wide range of tasks, it’s crucial to know what to avoid. Microsoft Copilot for Azure (preview) may occasionally be unable to fulfill your request. In these situations, you’ll typically see an explanation and additional details on how to perform the desired action.

Keep in mind these current limitations:

  • Currently, interactions are limited to five conversations per day and ten questions per user.
  • Only the top five items will be displayed in certain response lists.
  • Using a resource’s name won’t work for some tasks and queries; instead, the Azure resource ID needs to be supplied.
  • The preview version of Microsoft Copilot for Azure is presently only available in English.

Comments

comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here