Lets set up the authentication in this post. You should always secure your application and never leave it exposed out to the web.
Click on Authentication menu and turn it on. In the drop down, select Azure Active Directory. In the Authentication providers click on Azure Active Directory to start configuring it.
Select the Express mode. This will create an web App registration.
Once authentication is configured. Lets set up a native Application registration. This step is only required if you are trying to communicate to the web service via a desktop applications, mobile application, third party tools to access your web services.
More information on application permissions and authentication on the Microsoft article.
Navigate the the Active directory menu and click on Application permissions. You will see the “Web app/API” application registration. We will create a Native application registration.
When creating it you will be asked to enter a redirect URI. Enter a valid uri.
Click on the Native application registration and click on Required permissions. Add the Web App registration and Grant permissions (button at the top).
When you are adding it. You will have to search for it. It wont show up on the list automatically.
We are done.
Now lets test it by navigating to the swagger url. You will be asked to log in and also accept permissions.
There is a test service you can run to check that it has recognised you.