Home / How-To / Azure OpenAI vision Power Apps integration: Step‑by‑Step Guide
Azure OpenAI vision Power Apps integration: Step‑by‑Step Guide
You can embed Azure OpenAI Vision (GPT‑Image models) into a Power Apps canvas app by creating a custom connector that calls the image‑generation endpoint, wiring the connector to a button or form, and saving the returned base64 image to a Dataverse column.

Which Azure OpenAI model should I use for image generation?
- The original DALL·E 3 model is retired; use a GPT‑Image series model instead.
- GPT‑Image‑2.5‑Sunburst and GPT‑Image‑2.5‑Flare provide the highest fidelity and fastest cost‑effective generation.
- All GPT‑Image models accept text + optional image inputs and return images as base64 strings.
- Review the capability table in the official guide for resolution limits, quality options, and in‑painting support: Azure OpenAI image generation models.
- Choose a model that matches your scenario (e.g., Sunburst for detailed editing, Flare for bulk generation).
How do I create a custom connector for Azure OpenAI Vision?
- Prerequisites
- Open Power Apps → Data → Custom connectors → New custom connector → Create from blank.
- General information
- Security
- Definition
- Azure subscription with an OpenAI resource in a supported region. - API key (or Entra ID) for the resource. - Power Apps environment with admin rights.
- Name: AzureOpenAIVision - Description: Calls the GPT‑Image image‑generation endpoint.
- Choose API key authentication. - Header name: api-key - Value: your Azure OpenAI key.
- Add an action called GenerateImage. - Set Request URL to https://<your‑resource>.openai.azure.com/openai/deployments/<deployment‑name>/images/generations?api-version=2024‑08‑01-preview. - HTTP method: POST. - Request body (JSON):
{ "model": "gpt-image-2.5-sunburst", "prompt": "{{Prompt}}", "size": "1024x1024", "quality": "high", "n": 1 }
- Mark Prompt as a required string parameter.
- Response
- Test the connector with a sample prompt to confirm you receive a base64 string.
- Save and publish the connector.
- The API returns a JSON with a data array containing b64_json strings. Map the response to a single output called ImageBase64.
> The endpoint format and parameter names follow the Azure OpenAI image generation API described in the quickstart: Run an image generation request.

How do I add the connector to a canvas app and display the image?
- Open or create a canvas app in Power Apps Studio.
- In the Data pane, add the
AzureOpenAIVisionconnector. - Insert a Text Input control (
txtPrompt) for the user’s description. - Insert a Button (
btnGenerate). Set its OnSelect property to:
powerapps Set(varResponse, AzureOpenAIVision.GenerateImage({Prompt: txtPrompt.Text})); Set(varImg, "data:image/png;base64," & varResponse.ImageBase64);
- Add an Image control and set its Image property to
varImg. The image appears instantly after the API call finishes. - To persist the image, create a Dataverse table (e.g.,
GeneratedImages) with a Multiline Text column namedImageBase64. - Add a Patch statement after the image is generated:
powerapps Patch(GeneratedImages, Defaults(GeneratedImages), { Prompt: txtPrompt.Text, ImageBase64: varResponse.ImageBase64 })
- Optionally, add a Gallery that pulls from
GeneratedImagesand displays each stored image using the samedata:image/png;base64,prefix.
These steps follow the standard practice for calling custom connectors in Power Apps and storing binary data as base64 strings in Dataverse.
What to do if it does not work
- Authentication errors – Verify that the API key belongs to the same Azure OpenAI resource and that the key has not expired. If you use Entra ID, replace the API‑key header with a bearer token obtained via
DefaultAzureCredentialas described in the Azure OpenAI Responses API docs. - 404 or model not found – Confirm the deployment name and model (
gpt-image-2.5-sunburstetc.) exist in your resource region. Model availability is listed in the models page. - Base64 not returned – Check the response mapping in the custom connector. The output field must point to
data[0].b64_json. - Image does not render in Power Apps – Ensure the
Imagecontrol value includes thedata:image/png;base64,prefix. Without the prefix the control treats the string as a URL. - Dataverse save fails – The
ImageBase64column must be a Multiline Text (plain text) field, not an attachment field. Also verify the app has write permissions on the table. - Rate‑limit or quota exceeded – Review your Azure subscription’s quota for the selected GPT‑Image model. Reduce the
nparameter or increase the quota through Azure support.
If none of these steps resolve the issue, open a support ticket in the Azure portal with the request ID returned in the API error response.
How can I extend the solution with editing or variations?
- GPT‑Image‑2.5 models support in‑painting. Add a second optional parameter
mask(base64 PNG) to the request body to specify the area to edit. - To generate variations, set
promptto an empty string and supply only the originalimageandmask. - The same custom connector can be reused; just add extra input fields in the Power Apps UI for mask upload.
- For more details on in‑painting capabilities, see the section “Editing (inpainting / variations)” in the model table of the official guide.
These advanced features let you build interactive design tools, product mockups, or dynamic visualizations directly inside Power Apps.
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 a paid Azure subscription to use the GPT‑Image models?
Yes. The models are part of Azure OpenAI and require an Azure subscription with a valid OpenAI resource in a supported region.
Can I store the generated image as a file instead of base64?
Power Apps cannot write files directly to Dataverse; the common pattern is to keep the base64 string and render it in an Image control. If you need a file, export the base64 data to Azure Blob Storage using a Flow or Power Automate step.
Is the custom connector reusable across multiple apps?
Yes. Once published, the connector appears in the Data pane of any canvas or model‑driven app within the same environment.
What limits apply to the number of images per request?
All GPT‑Image models allow 1‑10 images per request via the n parameter. Higher values increase latency and cost.