Azure / Azure/app-service-linux-docs

Azure App Service built-in authentication on gRPC not working

Open
#167 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
150
Forks
90
Avg merge
2m
Merged PRs (30d)
1

Description

I deployed into Azure App Service a .NET 7 [sample hello gRPC API][1] on Linux OS

public class GreeterService : Greeter.GreeterBase
{
private readonly ILogger _logger;

public GreeterService(ILogger logger)
{
_logger = logger;
}

public override Task SayHello(HelloRequest request,
ServerCallContext context)
{
_logger.LogInformation("Saying hello to {Name}", request.Name);
return Task.FromResult(new HelloReply
{
Message = "Hello " + request.Name
});
}
}

It is functioning properly and responding with the Hello greeting after I called it using Postman.

Now that I've attempted to use the built-in [Authentication][2] functionality on Azure App Service with Microsoft Identity Platform, I haven't encountered any problems using Postman to call it without authentication.

Did you realize that gRPC is compatible with Azure App Service Authentication?

This is my appsettings.json

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
}
}

and this the Program.cs

using GrpcGreeter.Services;
using System.Reflection;

var builder = WebApplication.CreateBuilder(args);

// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682

// Add services to the container.
builder.Services.AddGrpc();
builder.Services.AddGrpcReflection();


var app = builder.Build();

// Configure the HTTP request pipeline.
app.MapGrpcReflectionService();
app.MapGrpcService();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");

app.Run();

[1]: https://learn.microsoft.com/en-us/aspnet/core/grpc/?view=aspnetcore-7.0
[2]: https://learn.microsoft.com/en-us/azure/app-service/overview-authentication-authorization

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.