We are encountering an issue where our Azure Functions do not appear in the Azure Portal's Function App Functions list when we apply the [FunctionAuthorize] attribute from the DarkLoop.Azure.Functions.Authorize package and include authentication and authorization configuration in our Startup.cs file.
Environment Details:
Azure Functions Version: v4
Target Framework: .NET 8 (net8.0)
Functions Runtime: In-Process
DarkLoop.Azure.Functions.Authorize Version: 3.1.2 and 4.0.0
Deployment Method: Azure DevOps YAML pipeline
Hosting Environment: Azure Function App
Problem Description:
When we include the following authentication and authorization configuration in our Startup.cs along with the [FunctionAuthorize] attribute, the functions do not appear in the Azure Portal:
// Authentication & Authorization.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
var serviceProvider = builder.Services.BuildServiceProvider();
var workflowSecrets = serviceProvider.GetService<WorkflowServerSecretsSettings>();
builder.Services
.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = false,
ValidateAudience = false,
ValidateLifetime = true,
ValidIssuer = workflowSecrets.Jwt.Issuer,
ValidAudience = workflowSecrets.Jwt.Audience,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(workflowSecrets.Jwt.SecretKey)),
NameClaimType = JwtRegistered ClaimNames.Sub
};
});
builder.Services.AddAuthorization(auth => auth.AddSecurityPolicy());
When we remove this code and the [FunctionAuthorize] attribute from our functions, they appear in the Azure Portal as expected.
Functionality:
- Despite not appearing in the portal, the functions are still operational.
- The issue seems to be that the authentication middleware is interfering with the Azure Functions host's ability to enumerate the functions or access internal endpoints.
Question:
- Is there a recommended approach to ensure that functions appear in the Azure Portal?
We are encountering an issue where our Azure Functions do not appear in the Azure Portal's Function App Functions list when we apply the [FunctionAuthorize] attribute from the DarkLoop.Azure.Functions.Authorize package and include authentication and authorization configuration in our Startup.cs file.
Environment Details:
Azure Functions Version: v4
Target Framework: .NET 8 (net8.0)
Functions Runtime: In-Process
DarkLoop.Azure.Functions.Authorize Version: 3.1.2 and 4.0.0
Deployment Method: Azure DevOps YAML pipeline
Hosting Environment: Azure Function App
Problem Description:
When we include the following authentication and authorization configuration in our Startup.cs along with the [FunctionAuthorize] attribute, the functions do not appear in the Azure Portal:
When we remove this code and the [FunctionAuthorize] attribute from our functions, they appear in the Azure Portal as expected.
Functionality:
Question: