0
votes

I have a flask rest api and currently it has no authentication. I want to learn and try azure active directory authentication with my flask api. I don't have much experience with azure active directory and I have looked some documentation from microsoft https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code. I have registered my app in azure active directory. I have azure tenant id, client id. But I am confused and lost on how do I use those keys in my flask rest api. In the below, if i want my function "index" should be authenticated and this app is registered in azure active directory. To make it work, what should I do next ? Any suggestions and advice would be great.

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "Hello, World!"

if __name__ == '__main__':
    app.run(debug=True)
1
Have a look at examples provided by MSFT docs.microsoft.com/en-us/azure/python/?view=azure-pythonPGHE
Did you get a detailed process of how to achieve this?Dennis

1 Answers

1
votes

If you want to secure your API with Azure AD, after you register the AD App, you need to expose it as APIs.

enter image description here

Reference - Configure an application to expose web APIs