Author API Management policies using Microsoft Copilot in Azure

Microsoft Copilot in Azure (preview) can author Azure API Management policies based on your requirements. By using Microsoft Copilot in Azure, you can create policies quickly, even if you're not sure what code you need. This can be especially helpful when creating complex policies with many requirements.

To get help authoring API Management policies, start from the Design tab of an API you previously imported to your API Management instance. Be sure to use the code editor view. Ask Microsoft Copilot in Azure to generate policy definitions for you, then copy the results right into the editor, making any desired changes. You can also ask questions to understand the different options or change the provided policy.

When you're working with API Management policies, you can also select a portion of the policy, right-click, and then select Explain. This will open Microsoft Copilot in Azure and paste your selection with a prompt to explain how that part of the policy works.

Note

The tasks and sample prompts listed here show a few of the areas where Microsoft Copilot in Azure (preview) can be especially helpful. However, this is not a complete list of all the things you can do. We encourage you to experiment with your own prompts and see how Microsoft Copilot in Azure (preview) can help you manage your Azure resources and environment.

Important

Microsoft Copilot in Azure (preview) is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Sample prompts

Here are a few examples of the kinds of prompts you can use to get help authoring API Management policies. Modify these prompts based on your real-life scenarios, or try additional prompts to create different kinds of policies.

  • "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"

Examples

When creating an API Management policy, you can say "Generate a policy to configure rate limiting with 5 requests per second." Microsoft Copilot in Azure provides an example and explains how you might want to modify the provided based on your requirements.

Screenshot of Microsoft Copilot in Azure generating a policy to configure rate limiting.

In this example, a policy is generated based on the prompt "Generate a policy to remove a 'X-AspNet-Version' header from the response."

Screenshot of Microsoft Copilot in Azure generating a policy to remove a header.

When you have questions about a certain policy element, you can get more information by selecting a section of the policy, right-clicking, and selecting Explain.

Screenshot of right-clicking a section of an API Management policy to get an explanation from Microsoft Copilot in Azure .

Microsoft Copilot in Azure explains how the code works, breaking down each specific section.

Screenshot of Microsoft Copilot in Azure providing information about a specific API Management policy.

Next steps