401 Error while connecting Azure web app with custom connector in PowerApps

%3CLINGO-SUB%20id%3D%22lingo-sub-1652980%22%20slang%3D%22en-US%22%3E401%20Error%20while%20connecting%20Azure%20web%20app%20with%20custom%20connector%20in%20PowerApps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1652980%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20have%20followed%26nbsp%3B%3C%2FSPAN%3E%3CA%20title%3D%22%5B3%5D%3A%20%2Fanswers%2Fstorage%2Fattachments%2F23763-image.png%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fconnectors%2Fcustom-connectors%2Fcreate-custom-connector-aad-protected-azure-functions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMS%20article%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bto%20configure%20Azure%20AD%20authentication%20to%20my%20Azure%20Webapp%20(article%20describes%20with%20Azure%20function).%20In%20this%20web%20app%20I%20am%20having%20API%20which%20I%20am%20calling%20as%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmysite.azurewebsites.net%2Fapi%2FPlugin%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmysite.azurewebsites.net%2Fapi%2FgetNamesMethod%3C%2FA%3E%3CSPAN%3E.%20This%20is%20working%20fine%20if%20I%20don't%20have%20any%20authentication%20for%20my%20web%20app.%20Based%20on%20the%20documentation%20I%20have%20configured%20azure%20AD%20authentication%20by%20creating%20new%20app%20registration%20and%20secret.%20In%20PowerApps%20I%20have%20created%20custom%20connector%20and%20selected%20authentication%20as%20OAuth2.0%20and%20provided%20necessary%20details.%20While%20testing%20it%20is%20giving%20401%20unauthorized%20exception.%20What%20I%20am%20missing%20in%20this%20configuration%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22powerappserror.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F217526i3BF23D017D729E0A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22powerappserror.png%22%20alt%3D%22powerappserror.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1652980%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Active%20Directory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1729668%22%20slang%3D%22en-US%22%3ERe%3A%20401%20Error%20while%20connecting%20Azure%20web%20app%20with%20custom%20connector%20in%20PowerApps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1729668%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F94568%22%20target%3D%22_blank%22%3E%40Mihir%20Yelamanchili%3C%2FA%3E%26nbsp%3B%20%26nbsp%3BI'm%20seeing%20the%20same%20error%2C%20did%20you%20ever%20get%20it%20resolved%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

I have followed MS article to configure Azure AD authentication to my Azure Webapp (article describes with Azure function). In this web app I am having API which I am calling as https://mysite.azurewebsites.net/api/getNamesMethod. This is working fine if I don't have any authentication for my web app. Based on the documentation I have configured azure AD authentication by creating new app registration and secret. In PowerApps I have created custom connector and selected authentication as OAuth2.0 and provided necessary details. While testing it is giving 401 unauthorized exception. What I am missing in this configuration?

powerappserror.png

3 Replies

@Mihir Yelamanchili   I'm seeing the same error, did you ever get it resolved ?

@123123123 Nope. Still waiting for answer. Raised ticket with Microsoft. They haven't provided solution yet. 

Hi there, this is a late reply. I got a very similar issue. I created a Function App and used a custom connector in PowerApp to connect to my functions. Also getting the same 401 error when I test the connector.

I resolved this issue by going to my Function App's Authentication setting (new version of authentication, not classic), edited the setting for Identity Provider, and changed Issuer URL and removed 'v2.0'.