Hi guys,
I wanted to generate images from Copilot Studio, but I noticed this feature isn’t currently supported (it works in Copilot Studio Lite, though). So, I started researching alternatives using Azure AI Foundry and the Azure OpenAI Image API.
Here’s what I learned:
Why Azure OpenAI?
I can get OpenAI models to do Image Edits using an API directly in Azure, if you have an HuggingFace or Gemini API 🍌 you could use it
How I Integrated It with Power Automate/Copilot Studio
- Create an Azure OpenAI resource in AI Foundry and enable the
gpt-image-1 model.
- Get your endpoint and API key from Azure.
- In Power Automate, add an HTTP action:
{
"$content-type": "multipart/form-data",
"$multipart": [
{
"body": {
"$content": "@{triggerBody()?['file']?['contentBytes']}",
"$content-type": "image/png"
},
"headers": {
"Content-Disposition": "form-data; name=\"image[]\"; filename=\"file.png\""
}
},
{
"body": "an icon of a beef stake",
"headers": {
"Content-Disposition": "form-data; name=\"prompt\""
}
},
{
"body": "gpt-image-1",
"headers": {
"Content-Disposition": "form-data; name=\"model\""
}
},
{
"body": "1024x1024",
"headers": {
"Content-Disposition": "form-data; name=\"size\""
}
},
{
"body": "1",
"headers": {
"Content-Disposition": "form-data; name=\"n\""
}
},
{
"body": "medium",
"headers": {
"Content-Disposition": "form-data; name=\"quality\""
}
},
{
"body": "100",
"headers": {
"Content-Disposition": "form-data; name=\"output_compression\""
}
},
{
"body": "png",
"headers": {
"Content-Disposition": "form-data; name=\"output_format\""
}
}
]
}
the body part can be:
"body": {
"$content": "@{triggerBody()?['file']?['contentBytes']}",
"$content-type": "image/png"
},
or
Power Automate will handle the multipart boundaries automatically.
Some issues that I experiment
- Don’t use JSON body with
Content-Type: application/json. The API requires multipart/form-data.
- Avoid
base64ToString()—send the Base64 content directly from Get file content.
- If you see
400 Bad Request, check that your headers and body format match the API requirements.
Sources: