Fix resource connection will use managed identity in local authentication

This commit is contained in:
Hanxiao Liu 2024-07-29 08:04:50 +08:00
Родитель 7af344c9f8
Коммит 8b8f857f29
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -129,7 +129,7 @@ public class SqlCosmosDBAccountResourceDefinition extends AzureServiceResource.D
final List<Pair<String, String>> properties = new ArrayList<>();
properties.add(Pair.of("spring.cloud.azure.cosmos.endpoint", String.format("${%s_ENDPOINT}", Connection.ENV_PREFIX)));
properties.add(Pair.of("spring.cloud.azure.cosmos.database", String.format("${%s_DATABASE}", Connection.ENV_PREFIX)));
properties.add(Pair.of("spring.cloud.azure.cosmos.credential.managed-identity-enabled", String.valueOf(true)));
// properties.add(Pair.of("spring.cloud.azure.cosmos.credential.managed-identity-enabled", String.valueOf(true)));
if (connection.getAuthenticationType() == AuthenticationType.USER_ASSIGNED_MANAGED_IDENTITY) {
properties.add(Pair.of("spring.cloud.azure.cosmos.credential.client-id", String.format("${%s_CLIENT_ID}", Connection.ENV_PREFIX)));
}

Просмотреть файл

@ -142,7 +142,7 @@ public class StorageAccountResourceDefinition extends BaseStorageAccountResource
properties.add(Pair.of("spring.cloud.azure.storage.blob.account-name", String.format("${%s_ACCOUNT_NAME}", Connection.ENV_PREFIX)));
properties.add(Pair.of("spring.cloud.azure.storage.blob.endpoint", String.format("https://${%s_ACCOUNT_NAME}.blob%s", Connection.ENV_PREFIX, suffix)));
}
properties.add(Pair.of("spring.cloud.azure.storage.blob.credential.managed-identity-enabled", String.valueOf(Boolean.TRUE)));
// properties.add(Pair.of("spring.cloud.azure.storage.blob.credential.managed-identity-enabled", String.valueOf(Boolean.TRUE)));
// for user assigned managed identity
if (connection.getAuthenticationType() == AuthenticationType.USER_ASSIGNED_MANAGED_IDENTITY) {
properties.add(Pair.of("spring.cloud.azure.storage.blob.credential.client-id", String.format("${%s_CLIENT_ID}", Connection.ENV_PREFIX)));