-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Changes Cosmos to use MI connection #4026
Conversation
de060ba
to
975ffd6
Compare
src/Microsoft.Health.Fhir.CosmosDb.Initialization/Features/Storage/ArmSdkCollectionSetup.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosClientInitializer.cs
Fixed
Show fixed
Hide fixed
e34fe66
to
48202d5
Compare
src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/CosmosDbCollectionPhysicalPartitionInfo.cs
Fixed
Show fixed
Hide fixed
793e7c8
to
2519ee2
Compare
src/Microsoft.Health.Fhir.CosmosDb.Initialization/Features/Storage/ArmSdkCollectionSetup.cs
Fixed
Show fixed
Hide fixed
2519ee2
to
45952ea
Compare
if (_dataStoreConfiguration.UseManagedIdentity) | ||
{ | ||
resourceKey = await GenerateAuthTokenAad( | ||
host, | ||
cancellationToken); | ||
} | ||
else | ||
{ | ||
resourceKey = await GenerateAuthToken( | ||
"get", | ||
"pkranges", | ||
$"dbs/{_dataStoreConfiguration.DatabaseId}/colls/{_collectionConfiguration.CollectionId}", | ||
date, | ||
key)); | ||
key); | ||
} |
Check notice
Code scanning / CodeQL
Missed ternary opportunity
src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/FhirCosmosClientInitializer.cs
Fixed
Show fixed
Hide fixed
4e0eb3a
to
ec96065
Compare
@@ -355,6 +356,7 @@ private void AddTelemetryProvider(IServiceCollection services) | |||
{ | |||
var configuration = new TelemetryConfiguration(); | |||
Configuration.GetSection("Telemetry").Bind(configuration); | |||
services.AddTransient<IMeterFactory, DummyMeterFactory>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fhibf this failed to resolve for me when running locally against cosmos, any ideas?
src/Microsoft.Health.Fhir.CosmosDb/Features/Storage/CosmosContainerProvider.cs
Fixed
Show resolved
Hide resolved
cb2cd50
to
a1d5b8f
Compare
public bool UseManagedIdentity { get; set; } | ||
|
||
public bool AllowDatabaseCreation { get; set; } = true; | ||
|
||
public bool AllowCollectionSetup { get; set; } = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apurvabhaleMS - We'll need these new settings in managed service :)
UseManagedService = true
AllowDatabaseCreation = false
AllowCollectionSetup = false
Though in thinking about it, if we add the Cosmos DB Operator
permission too it would setup the db automatically, like it used to...
UseManagedService = true
AllowDatabaseCreation = false
AllowCollectionSetup = true
...osoft.Health.Fhir.CosmosDb.Initialization/Features/Storage/ResourceManagerCollectionSetup.cs
Show resolved
Hide resolved
...osoft.Health.Fhir.CosmosDb.Initialization/Features/Storage/ResourceManagerCollectionSetup.cs
Show resolved
Hide resolved
@@ -181,7 +181,21 @@ private static IFhirServerBuilder AddCosmosDbPersistence(this IFhirServerBuilder | |||
.Transient() | |||
.AsService<ICollectionDataUpdater>(); | |||
|
|||
services.Add<ResourceManagerCollectionSetup>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would ResourceManagerCollectionSetup always be invoked?
I think for OSS it should, thinking more in terms of SF and AKS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is registered as self, but not always resolved. If none of the setup functionality is required then you can register the default:
services.RemoveAll<ICollectionSetup>()
services.Add<ICollectionSetup, DefaultCollectionSetup>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to below. When AllowDatabaseCreation and AllowCollectionSetup are false then it will return the noop provider
...osoft.Health.Fhir.CosmosDb.Initialization/Features/Storage/ResourceManagerCollectionSetup.cs
Show resolved
Hide resolved
a0ee0b6
to
dec47bc
Compare
dec47bc
to
db42bec
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
This pull request introduces several changes across multiple files to enhance Azure resource management, improve Cosmos DB configuration, and add new features to the FHIR server configuration. The most important changes include adding new package versions, modifying Azure deployment templates, and updating Cosmos DB configurations to support managed identity.
Azure Deployment Template Updates:
samples/templates/default-azuredeploy-docker.json
: Added Cosmos DB role assignments, database, and configuration settings for FHIR server deployments. [1] [2] [3] [4] [5] [6]Cosmos DB Configuration Improvements:
src/Microsoft.Health.Fhir.CosmosDb.Core/Configs/CosmosDataStoreConfiguration.cs
: Added properties to support managed identity and refined database creation settings. [1] [2]src/Microsoft.Health.Fhir.CosmosDb.Core/Features/Storage/ICollectionSetup.cs
: Updated interface to include a method for installing stored procedures and versioned collection settings updates.src/Microsoft.Health.Fhir.CosmosDb.Core/Features/Storage/ICosmosClientTestProvider.cs
: Simplified thePerformTestAsync
method signature.FHIR Server Configuration Updates:
src/Microsoft.Health.Fhir.Api/Configs/FhirServerConfiguration.cs
: AddedResourceManagerConfig
to the FHIR server configuration.src/Microsoft.Health.Fhir.Core/Configs/ResourceManagerConfig.cs
: Introduced a new configuration class for resource management.Azure Resource Management Enhancements:
Directory.Packages.props
: AddedAzure.ResourceManager.CosmosDB
package version1.3.2
.build/jobs/add-aad-test-environment.yml
: Fixed resource group name handling in the Azure Key Vault restoration script.build/jobs/provision-deploy.yml
: Introduced variables for deployment name and resource group name to streamline the script.These changes collectively enhance the Azure resource management capabilities, improve the deployment process, and add new configuration options for Cosmos DB and FHIR server setups.
Related issues
Addresses AB#95002.
Supersedes/includes relevant changes from the following PRs:
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Feature (new capability to connect to Cosmos with MI)