Skip to content

Commit a2c50ed

Browse files
review: merge control flow for service principal auth
1 parent f69fca1 commit a2c50ed

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

plugins/out_azure_logs_ingestion/azure_logs_ingestion_conf.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins,
5454
}
5555

5656
/* Auth method validation and setup */
57-
if (!ctx->auth_type_str || strlen(ctx->auth_type_str) == 0) {
57+
if (!ctx->auth_type_str || strlen(ctx->auth_type_str) == 0 || strcasecmp(ctx->auth_type_str, "service_principal") == 0) {
5858
/* Default to service_principal if auth_type_str is NULL or empty */
5959
ctx->auth_type = FLB_AZ_LI_AUTH_SERVICE_PRINCIPAL;
6060

@@ -65,16 +65,6 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins,
6565
return NULL;
6666
}
6767
}
68-
else if (strcasecmp(ctx->auth_type_str, "service_principal") == 0) {
69-
ctx->auth_type = FLB_AZ_LI_AUTH_SERVICE_PRINCIPAL;
70-
71-
/* Verify required parameters for Service Principal auth */
72-
if (!ctx->tenant_id || !ctx->client_id || !ctx->client_secret) {
73-
flb_plg_error(ins, "When using service_principal auth, tenant_id, client_id, and client_secret are required");
74-
flb_az_li_ctx_destroy(ctx);
75-
return NULL;
76-
}
77-
}
7868
else if (strcasecmp(ctx->auth_type_str, "managed_identity") == 0) {
7969
/* Check if client_id indicates system-assigned or user-assigned managed identity */
8070
if (!ctx->client_id) {

0 commit comments

Comments
 (0)