Home / How-To / GPT-4o Vision Power Automate integration: Step‑by‑Step Guide
GPT-4o Vision Power Automate integration: Step‑by‑Step Guide
You can link GPT‑4o Vision in Azure OpenAI to Power Automate by creating a flow that calls the Azure OpenAI endpoint with the required headers and JSON body, then invoking that flow from Power Apps using the Run() function. The flow returns the model’s response, which you can display in the app.

What preparatory steps are required before building the flow?
- Azure OpenAI resources: Create an Azure OpenAI resource and enable the GPT‑4o (Omni) model. Record the endpoint URL, deployment name, and API key.
- Power Platform licensing: Ensure you have a Power Apps or Power Automate license that permits custom connector usage.
- Permissions: Grant the Power Automate service principal the *Microsoft.OpenAI/* role on the Azure resource so the flow can authenticate with the API key.
- Image format: The flow expects a base64‑encoded image string; Power Apps will generate this using
JSON(ImageControl, JSONFormat.IncludeBinaryData).
These items match the checklist described in the Japanese tutorial on calling GPT‑4o from a canvas app via Power Automate.
How do you build the Power Automate flow that calls GPT‑4o Vision?
- Create a new instant‑cloud flow in Power Automate and give it a descriptive name, e.g., *GPT‑4o‑Image‑analyze*.
- Add a trigger – select Manually trigger a flow and add a Text input called
imageBase64. - Add an HTTP action – configure it as follows:
- Method: POST - URI: https://{your‑resource}.openai.azure.com/openai/deployments/{deployment‑name}/chat/completions?api-version=2023-05-15 - Headers: - api-key: your Azure OpenAI API key (store in a secure parameter, not plain text) - Content-Type: application/json - Body (minimal version):
{ "model": "gpt-4o", "messages": [ { "role": "system", "content": "Analyze the supplied image and provide a concise description in Japanese." }, { "role": "user", "content": [ { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,@{triggerBody()?['imageBase64']}", "detail": "high" } }, { "type": "text", "text": "Describe what is shown in the image. Return JSON with a single field observation." } ] } ], "temperature": 0.7, "response_format": { "type": "json_object" } }
- Parse the response – add a Parse JSON action using the schema
{ "type": "object", "properties": { "observation": { "type": "string" } }, "required": ["observation"] }. - Return the result – use the Respond to a PowerApp or flow action and map the parsed
observationfield to an output namedresult. - Save the flow. The tutorial in S1 shows the same header and body configuration with screenshots of each step.

How can Power Apps invoke the flow and display the AI’s answer?
- Create a canvas app (phone or tablet layout) and add the following controls:
- Set the AddPicture control to store the image in a variable, e.g.,
Set(selectedImg, AddPicture1.Media); - Convert the image to base64 when the *Analyze* button is pressed:
- AddPicture button – lets the user pick an image. - Image control – shows the selected picture. - Button – labeled *Analyze*. - TextInput (multi‑line) – will receive the GPT‑4o response.
powerapps Set(resp, 'GPT-4o-Image-analyze'.Run( Substitute( JSON(selectedImg, JSONFormat.IncludeBinaryData), "\"", "" ) ).result ); UpdateContext({ analysisResult: resp })
- The Substitute call removes stray quotation marks, as noted in the Qiita guide.
- Show the result – set the
Defaultproperty of the multi‑line TextInput toanalysisResult. - Test – run the app, pick an image, and click *Analyze*. The flow returns a JSON object; the app extracts the
observationfield and displays it.
The Qiita article provides the exact OnSelect formula and explains why JSONFormat.IncludeBinaryData is essential for passing binary data to the flow.
What to do if it does not work?
- Validate the API key – confirm that the key stored in the HTTP header matches the Azure OpenAI resource. A common mistake is using a key from a different deployment, which results in a 401 error.
- Check the endpoint URL – the deployment name must be identical to the name shown in the Azure portal. Typos cause a 404 response.
- Inspect the base64 payload – in Power Apps, preview the value of
JSON(selectedImg, JSONFormat.IncludeBinaryData)with a label. It should start withdata:image/jpeg;base64,followed by the encoded string. Missing thedata:image/...;base64,prefix leads to “invalid image_url” errors from the model. - Review the flow run history – open the failed flow run in Power Automate, expand the HTTP action, and look at the Body and Response sections. Errors such as *"detail must be one of low, high, auto"* indicate an incorrect
detailfield. - Confirm response parsing – ensure the Parse JSON action schema matches the actual response. If the model returns additional fields, update the schema accordingly.
- Re‑publish the app – after fixing the flow, republish the canvas app so the new flow version is used.
These troubleshooting steps follow the official guidance on handling HTTP‑action errors and Power Apps integration issues provided by Microsoft documentation.
Which business scenarios benefit from GPT‑4o Vision in Power Automate?
- Ticket triage: Attach a screenshot of a support request; the flow extracts key details and auto‑populates a ServiceNow or Teams ticket.
- Document classification: Scan a picture of a printed form; GPT‑4o returns JSON tags that Power Automate can use to route the file.
- Quality inspection: Upload a product photo; the model reports defects, and the flow triggers a notification to the production line.
- Marketing content generation: Provide a product image; GPT‑4o creates a description that feeds into a Dynamics 365 campaign.
Each scenario leverages the “image‑to‑JSON” response format, which lets downstream Power Automate actions consume structured data without custom code.
Menus and names can change as products update. If a step looks different, check the product's own help page.
Frequently asked questions
Do I need to write any custom connector to call GPT‑4o from Power Automate?
No. The standard HTTP action can call the Azure OpenAI endpoint directly; a custom connector is optional only for reuse across many flows.
Can I use GPT‑4o Vision with a Power Automate scheduled flow?
Yes. Replace the manual trigger with a Recurrence trigger, supply the base64 image from a SharePoint or OneDrive file, and the same HTTP request will process each image on schedule.
Is there a limit on image size for GPT‑4o Vision?
Azure OpenAI caps the image payload at 4 MB when encoded as base64. Larger files must be resized before sending.
How is billing handled for vision calls?
Vision tokens are counted the same way as text tokens; each image consumes tokens based on its content. Billing appears on the Azure OpenAI usage page.