[release-11.5.3] Azure: Correctly set instance settings based on new credentials (#101563)

Azure: Correctly set instance settings based on new credentials (#99112)

Correctly set value based on new credentials

(cherry picked from commit f39c5bb45c)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot]
2025-03-04 17:10:25 +00:00
committed by GitHub
co-authored by Andreas Christou
parent 027524dd98
commit 596b3e42f5
@@ -60,15 +60,17 @@ export default class Datasource extends DataSourceWithBackend<AzureMonitorQuery,
this.variables = new VariableSupport(this);
this.currentUserAuth = instanceSettings.jsonData.azureAuthType === 'currentuser';
const credentials = instanceSettings.jsonData.azureCredentials;
if (credentials && instanceOfAzureCredential<AadCurrentUserCredentials>('currentuser', credentials)) {
this.currentUserAuth = true;
if (!credentials.serviceCredentials) {
this.currentUserAuthFallbackAvailable = false;
} else {
this.currentUserAuthFallbackAvailable = isCredentialsComplete(credentials.serviceCredentials, true);
}
} else {
// Handle legacy credentials case
this.currentUserAuth = instanceSettings.jsonData.azureAuthType === 'currentuser';
this.currentUserAuthFallbackAvailable = false;
}
}