0

we want to use azure active directory for function app authetication after enabling azureactive directory express mode.we have selected loginwithazureactivedirectory option. when we are hitting function through postman it is giving html of log in screen of micro soft. with out that sceen cant we access the fucntion app uRL.

Please find the below screen for your referenceenter image description here

Any help is appreciated on this

Md Farid Uddin Kiron
  • 16,817
  • 3
  • 17
  • 43
NarsingRao
  • 47
  • 7

1 Answers1

0

After you successfully configure Azure AD for your web app, you need to use the access token to access your application. I get an access token from AAD using clientID and clientSecret using the following code:

 METHOD: POST

Url : https://login.microsoftonline.com/your directory ID/oauth2/token 

    HEADERS:  Content-Type : application/x-www-form-urlencoded

    BODY: grant_type+=client_credentials&resource+=”your Function url”&client_id+++++=”the application that your register  id”&client_secret+=”the key you create”

Please note that according to the Azure Resources portal(https://resources.azure.com/), the default allowedAudiences is

"https://{functionAppName}.azurewebsites.net/.auth/login/aad/callback" So I add the https://{functionAppName}.azurewebsites.net/ as allowed aduiences

enter image description here enter image description here Then I can use the access token directly. I test it with postman.

enter image description here enter image description here

Please note that if your azure function authentication level is not anonymous, you need to add the function key

Jim Xu
  • 21,610
  • 2
  • 19
  • 39