I am deploying a Logic App to Azure using Terraform, where I use the newer azapi provider. The logic app is a simple one where it sends an email to me whenever an article is published to an RSS feed.
For the logic app, I need two API connections for rss, and gmail. I'm deploying those 2 resources too, using azapi provider. The RSS connection gets deployed fine, but the gmail connector gets deployed and goes to Error status. Terraform apply command fails at deploying the logic app giving me this error.
--------------------------------------------------------------------------------
│ RESPONSE 400: 400 Bad Request
│ ERROR CODE: GmailConnectorPolicyViolation
│ --------------------------------------------------------------------------------
│ {
│ "error": {
│ "code": "GmailConnectorPolicyViolation",
│ "message": "The operation on workflow 'emailTestLogicApp' cannot be completed because it contains connections to 'gmail' connector which are not valid. Please re-authorize the connections and try again."
│ }
│ }
│ --------------------------------------------------------------------------------
│
│
│ with azapi_resource.workflow,
│ on emailTestLogicApp.tf line 102, in resource "azapi_resource" "workflow":
│ 102: resource "azapi_resource" "workflow" {
│
Does anyone know how should I write my gmail connection resource so that it gets authorized at the deployment please?
Make sure the gmail connection is done with access token and having the required permissions.
Check if the access token is expired .
Verify that the Azure AD application associated with your Logic App workflow has the necessary permissions to access the Gmail connector.
Go to "API Connections" tab in your Logic App designer,check gmail connector , and verifying that the Azure AD application has the necessary permissions.
If you deploy the ARM Template, API Connections wwill be created but inside logic apps you may have to update manually the connection by entering your credentials for the this service.
In logic app ,select re-authenticate to authenticate again
Then execute the flow again:
Reference: azure-docs/tutorial-process-email-attachments-workflow.md at main · MicrosoftDocs/azure-docs · GitHub