Yesterday I looked at how to use the Azure AI Foundry connector in Power Automate. Today I’m doing the same within Power Apps, creating a Q&A app using GPT 4.1.
The Q&A app
Table of Contents
So the app that I want to create needs to look like this

Now you could of course call the flow that we created yesterday from the app and then call this flow every time the user asks a question run the flow. But I’m going to take this a step further.
Calling the Azure AI Foundry connector from a Power App
First of all we need to add an input box, a Rich text editor and a button to the screen in the app.
Then we need to add the Azure AI Foundry connection. Make sure that you select the Azure AI Foundry Inference connector. The Azure AI Foundry Agent Service is a new connector that was released today. But that is going to be a different post soon.

Then the magic all happens within the button’s OnSelect code.
Set(myVar, ParseJSON("{""myValue"" : ""Return in HTML format remove html header, " & TextInput2.Text & """}"));
Set(varOutput, AzureAIFoundryInference.ChatCompletion( {'api-version': "2025-01-01-preview",
max_tokens:(1000),
model:("gpt-4.1"),
temperature:(1),
top_p:(1),
messages:([{role:"user",content: myVar.myValue}])
}
)
)
Now you might ask why set a variable using the ParseJSON function, can we not just use the code directly in the messages property? The challenge here is that the content in the messages property has to be untyped. Using the Parse JSONM we can very quickly create untyped data.
Formatting the output as HTML
Then within my prompt you will notice that we’re adding “Return in HTML format remove html header,” to the actual question entered by the user.
This will ensure that we get HTML returned rather than the default Markdown language. This is to make sure that our app will display formatted text properly.
Discover more from SharePains
Subscribe to get the latest posts sent to your email.
Hi Pieter
Same issue as with the Flow. “ResourceNot Found”.
Regards
Nigel
The problem isn’t at the Flow or Power App side. The problem will be at the Foundry side. For me it just fixed itself.
The connection works for me when I’m in development mode in the PowerApps application. When I launch the app from my phone or from the browser, I get the error 404 – Resource not found.
It sounds like access to the end point has been restricted from your phone. You might want to check the access restrictions on the AI Foundry endpoint.
Thank you very much! I’m looking for where the restriction might be; it could be a service location issue. Could it be a problem with the Target URI? I’m using this one: Target https://xxxxxxx-eastus2.openai.azure.com/openai/deployments/gpt-4o-mini
If you open a chat, we can have a look at setting up a Teams call. I’m happy to have a look and see if we can sort this out.
Im having the same problem too. did you guys fix it?
Hello, i get this error
Incompatible type. The ‘messages.content’ column in the data source you’re updating expects a ‘Table’ type and you’re using a ‘Dynamic’ type.
And when running:
AzureAIFoundryInference.ChatCompletion({
‘api-version’: (“2024-08-01-preview”),
model: (“gpt-4.1-mini”),
messages: (Table({
role: “user”,
content: {
Value: ParseJSON(
JSON(
Table({
Type: “text”,
Text: “aaa”
})
)
)
}
})),
max_tokens: (500), temperature:(1)
})
i get
AzureAIFoundryInference.ChatCompletion failed: {
“error”: {
“message”: “Missing required parameter: ‘messages[0].content[0].type’.”,
“type”: “invalid_request_error”,
“param”: “messages[0].content[0].type”,
“code”: “missing_required_parameter”
}
}
Could you please help me, Pieter?
Hi Brandon,
I had a quick look into this. My app that I created originally still works. However when I created a new app and copied all the controls across the app did not work. So my code was identical and the error the same as yours.
It looks like there is something broken in this connector, however strangely enough my original app is still the same as before. This might require a support call with Microsoft. Please feel free to open a chat and we can discuss this further.
Hey Pieter,
Yeah, i think i got you on LinkedIn, so we can keep in touch there, thanks!
Hi both,
Did you find a solution to the above problem? I am facing the same issue