Deployment on Azure App service with Windows Identity Authentication

System Information
  • Strapi Version: 4
  • Operating System: Windows
  • Database: MySql
  • Node Version: 14
  • NPM Version: 8
  • Yarn Version:

  1. Frontend development is done in Angular & the build files are copied to the “public” folder of Strapi project.
  2. In the development System, with Strapi’s API Token & “Authorized” Role Configured, the Application works fine.
  3. In Production ( Azure App Service ( windows ) , using Push deployment, & “Authentication set to Windows Identity”, All the GET requests are working, But “POST” requests are returning 403 forbidden.
    NOTE: Collections are give access to both “Authorized & Public” roles

When we talk about deploying an application on Azure App Service with Windows Identity Authentication involves several key configurations to ensure secure and seamless authentication. Ensure that you select an appropriate App Service Plan that supports your application’s requirements within the Azure Application Development framework.

In the Azure AD registration, make sure you configure the necessary redirect URIs and permissions.

Ensure your application is configured to use Windows Identity Authentication.

public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
.AddAzureAD(options => Configuration.Bind(“AzureAd”, options));

services.AddControllersWithViews(options =>
{
    var policy = new AuthorizationPolicyBuilder()
        .RequireAuthenticatedUser()
        .Build();
    options.Filters.Add(new AuthorizeFilter(policy));
});

}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler(“/Home/Error”);
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();

app.UseAuthentication();
app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllerRoute(
        name: "default",
        pattern: "{controller=Home}/{action=Index}/{id?}");
});

}