C
C#2y ago
malkav

✅ Trying to trigger Azure Function with OpenApi

So right, never had an issue with this but now all of a sudden... (I might have done something wrong, but can't find it... Right.. So I created an Azure Function with OpenApi tags, so I can call the Azure function from ../api/swagger/ui and test the various parameters and such. The way I setup my OpenApi tags above the Azure Function is the way I always did things, so I can secure them later. But when using them in localhost I never had to Authorize before being able to push the blue Execute button. But right now I've got the blue button but it won't trigger anything, and above the function it says I need to authorize??? I don't have an ApiKey since it's currently localhost. Unless I am missing something?? Here's the OpenApi tags:
[FunctionName("Execute")]
[OpenApiOperation("Run", tags: new[] { "Run" }, Visibility = OpenApiVisibilityType.Important)]
[OpenApiSecurity("function", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiRequestBody(contentType: "application/json; charset=utf-8", bodyType: typeof(RequestBody),
Description = "The example request JSON body", Example = typeof(RequestBodyExample))]
[OpenApiResponseWithBody(contentType: "application/json", bodyType: typeof(ResponseBody),
statusCode: HttpStatusCode.OK, Description = "The result", Example = typeof(ResponseBodyExample))]
public static async Task<IActionResult> RunAsync(
[FunctionName("Execute")]
[OpenApiOperation("Run", tags: new[] { "Run" }, Visibility = OpenApiVisibilityType.Important)]
[OpenApiSecurity("function", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)]
[OpenApiRequestBody(contentType: "application/json; charset=utf-8", bodyType: typeof(RequestBody),
Description = "The example request JSON body", Example = typeof(RequestBodyExample))]
[OpenApiResponseWithBody(contentType: "application/json", bodyType: typeof(ResponseBody),
statusCode: HttpStatusCode.OK, Description = "The result", Example = typeof(ResponseBodyExample))]
public static async Task<IActionResult> RunAsync(
What am I missing?
0 Replies
No replies yetBe the first to reply to this messageJoin