Tutorials/Power Automate/Classify and Route Customer Inquiries with Power Automate and Azure OpenAI
Power Automateintermediate

Classify and Route Customer Inquiries with Power Automate and Azure OpenAI

Tailor AI model responses without compromising data privacy: learn how to call Azure OpenAI models from a Power Automate flow to automatically categorize and direct incoming customer inquiries.

Topicsazure-ai
NA
Narmer Abader
@narmer · Published June 3, 2026

Every day, companies receive hundreds of customer messages, many of which require a manual triage step before they can be routed to the right team. By combining Power Automate with Azure OpenAI, you can automate that classification process while keeping your data secure—Azure OpenAI never uses your content for model retraining. The consumption‑based pricing also makes it affordable even at high volumes.

This walkthrough shows you how to build a flow that reads a customer inquiry, sends it to a GPT model deployed in Azure, and returns one of four predefined categories. You can then use that category to route the inquiry to a specific mail‑enabled distribution list, a Teams channel, or a Dynamics 365 case queue.

Scenario overview

We’ll create a classifier that places each incoming message into one of these buckets:

CategoryTypical example
Billing IssueDuplicate charges, refund requests, invoice discrepancies
Technical SupportLogin errors, feature failures, broken integrations
Account ManagementPassword resets, profile changes, closing an account
General InquiryProduct questions, partnership proposals, feedback

The flow will be triggered manually so you can test it with sample text, but the same pattern works with any trigger—new Office 365 email, a Microsoft Forms submission, or a row added to Dataverse.

Step 1 – Provision Azure OpenAI and deploy a model

Before Power Automate can call the AI, you need an Azure OpenAI resource and a deployed GPT model.

  1. In the Azure Portal, search for Azure OpenAI and click Create.
  2. Choose your Subscription, create or select a Resource Group, pick a Region (e.g. East US, West Europe), and give the resource a unique name. The Standard S0 pricing tier is sufficient for most scenarios.
  3. Accept the defaults on the remaining steps, then go to Review + create and Create.
  1. Once the deployment is complete, go to the resource’s Overview page and click Go to Azure AI Studio.
  2. In AI Studio, navigate to the Deployments tab and select Deploy base model.
  3. Choose gpt‑4o-mini (or any model that fits your cost and capability needs) and confirm.
  4. Leave the deployment name as default, set the Deployment type to Global Standard, and increase the Tokens per Minute Rate Limit to the maximum allowed for your tier. Then click Deploy.

Make a note of the endpoint URL and the API key—you’ll need them in the flow.

Step 2 – Write and test the system message in AI Studio

The system message tells the model what task to perform and how to format its answer. We’ll write one that enforces a four‑way classification.

  1. In AI Studio, go to the Playground tab.
  2. From the Deployment dropdown, select the model you just deployed.
  3. In the System message field, paste the prompt below and click Apply changes.
textSystem prompt for inquiry classification
You are an automated customer inquiry classifier. Your task is to read the customer message and assign one of the following categories:
- Billing Issue
- Technical Support
- Account Management
- General Inquiry

Respond with only the category name. Do not include any additional text or explanation.

Now test with a sample message. In the Chat session window, type:

textSample user message
I was charged twice for my subscription last month. Please help me get a refund.

Press Send. You should see a response of Billing Issue. If the result is inconsistent, adjust the system prompt until the model behaves reliably.

Step 3 – Build the Power Automate flow

We’ll construct a manual‑trigger flow that reproduces the same API call you just tested.

  1. Go to Power Automate and create a new Instant cloud flow with the Manually trigger a flow action.
  2. Add a Data Operation – Compose action and rename it to Compose_System_Message. Paste the same system prompt you used in the playground.
textCompose_System_Message input
You are an automated customer inquiry classifier. Your task is to read the customer message and assign one of the following categories:
- Billing Issue
- Technical Support
- Account Management
- General Inquiry

Respond with only the category name. Do not include any additional text or explanation.
  1. Add a second Compose action named Compose_Inquiry_Text. For testing, put a sample inquiry directly inside. In a real flow this would come from a trigger (e.g., email body).
textCompose_Inquiry_Text input
I can't log in to the portal. It keeps saying "invalid credentials" even after I reset my password.
  1. Add an HTTP action and configure it as follows:

    • Method: POST
    • URI: Use the endpoint from your Azure OpenAI resource, with the deployment name and API version. The pattern is: https://<your-resource>.openai.azure.com/openai/deployments/<deployment-id>/chat/completions?api-version=2024-02-15-preview
    • Headers:
      • Content-Type: application/json
      • api-key: your Azure OpenAI key (found in Keys and Endpoint under the resource)
    • Body:
jsonHTTP request body
{
"messages": [
  {
    "role": "system",
    "content": [
      {
        "type": "text",
        "text": "@{outputs('Compose_System_Message')}"
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": "@{outputs('Compose_Inquiry_Text')}"
      }
    ]
  }
],
"temperature": 0.3,
"top_p": 0.95,
"max_tokens": 50
}
  1. Add one more Compose action to extract the category from the response. Name it Compose_Extract_Category. Use the following expression:
textExtract category expression
first(body('HTTP_Classify_Inquiry')?['choices'])?['message']?['content']

Make sure the HTTP action’s output is correctly referenced in the expression (it may be named differently if you renamed it). The expression walks into the first choice, then the message object, and returns the content string.

  1. Save the flow.

Step 4 – Run the flow and verify

Click Test, choose Manually, and then Run. Once the run finishes, expand the final Compose action to see the classification result. For the sample “can’t log in” message you should see Technical Support.

Security and performance considerations

  • Protect your API key: For a production flow, avoid hardcoding the key in the HTTP action. Use Azure Key Vault with the Key Vault connector, or—if your environment supports it—configure Managed Identity on the flow and grant it the Cognitive Services OpenAI User role on the Azure OpenAI resource. Then use the HTTP with Microsoft Entra ID connector instead of the generic HTTP action.
  • Token limits: The sample uses max_tokens: 50 because the response is only a few words. For longer outputs (like generated emails) you may need to increase this value. Keep an eye on your rate limits and cost; smaller limits help control spending.
  • Temperature: A low temperature (0.1–0.3) produces more deterministic, repeatable classifications. Higher values add creativity but may lead to inconsistent labels.
  • API version: Always use a supported API version. The one shown (2024-02-15-preview) is current at the time of writing, but check the latest documentation for updates.

Common pitfalls

  • Missing Content-Type header: Without it, the HTTP action may not parse the body correctly, resulting in a 400 error.
  • Wrong API version: Using an outdated or unsupported version can break the request. Always verify against the official changelog.
  • System message not in array format: The content property must be an array containing a type/text object. Passing a plain string works in the playground but fails in the API.
  • Expression errors: The body('HTTP_Action_Name')?['choices'] path assumes the HTTP action’s output name matches what is used. Double‑check the action’s name in the expression and consider using the Parse JSON action with a schema to avoid confusion.

Conclusion

Azure OpenAI gives you the same GPT models used by ChatGPT but with enterprise‑grade data protection and pay‑as‑you‑go billing. Paired with Power Automate, you can build intelligent classifiers, summarizers, and content generators without ever sharing your proprietary data with a third party.

Start with a simple classification flow—like the one described here—and then explore other use cases: sentiment analysis, email generation, or even code explanation for support tickets. The architecture is the same; only the system prompt changes.

References