Sample configuration for ASP.Net Core 1.1 to use Azure AD for Service to Service Authentication. Update your Startup.cs to have the following public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(); ... } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseJwtBearerAuthentication(new JwtBearerOptions { Authority = "https://login.microsoftonline.com/{AAD Tenant Name or ID}", Audience = "{Application ID URL}" }); ... } Microsoft.AspNetCore.Authentication.JwtBearer defaults to using OpenID Connect discovery document to validate the bearer token. The Authority is the prefix for the the discovery document. The middleware will append ".well-known/openid-configuration/" to whatever you pass in to the Authority. If your IDP has a diffrent endpoint for the discovery document, you can specify the MetadataAddress option, tha...
In my post about getting the Azure AD JWT via Postman , we kind of skipped over the part on what the resource is when requesting a token. Basically, its the Application Id URI of the app you will be calling, not the app you are login in as. Let's talk through a scenario, using the https://github.com/Azure-Samples/active-directory-dotnet-daemon sample from my post on Service to Service auth. You would create two applications in Azure AD, and they don't even need to be in the same AD (we will cover that at a later date). The service that is going to consume the API (TodoListDaemon) is the one that would be using the method I described to get a bearer token, and it would have its own Application as we would use its App ID for the Client Id. Then the service hosting the API (TodoListService) would also have its own Application, but we don't need to generate an Application Key, as we are not logging on as this application. But in TodoListService we would p...