Logic App dynamic Authentication for HTTP connector

82 views Asked by At

I'm using the HTTP connector to connect to MSGraph. The authentication part differs from environments. In nonprod I'll like to use ActiveDirectoryOAuth because I'm target a Test tenant, but in prod I'll to use Managed Identity.

I have tried to do a condition in my ARM template, but that crashes the HTTP component because the "type" value it not valid... This means that the Logic app can't be saved in the designer nor can it be enable.

                        "HTTP_POST_-_Create_AAD_user": {
                            "inputs": {
                                "authentication": {
                                    "audience": "https://graph.microsoft.com/",
                                    "clientId": "@{if(equals(parameters('environment'), 'prd'), '', parameters('test_tenant_sp_client_id'))}",
                                    "secret": "@{if(equals(parameters('environment'), 'prd'), '', body('Get_secret_-_test_tenant_SP_client_secret')?['value'])}",
                                    "tenant": "@if(equals(parameters('environment'), 'prd'), '', parameters('test_tenant_id'))}",
                                    "type": "@{if(equals(parameters('environment'), 'prd'), 'ManagedServiceIdentity','ActiveDirectoryOAuth')}"
                                },
                                "body": "@outputs('Payload_AAD')",
                                "headers": {
                                    "Content-Type": "application/json"
                                },
                                "method": "POST",
                                "uri": "https://graph.microsoft.com/v1.0/users"
                            }
0

There are 0 answers