Skip to content
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

Use TokenCredential for Cosmos tests #33956

Merged
merged 1 commit into from
Jun 11, 2024
Merged

Use TokenCredential for Cosmos tests #33956

merged 1 commit into from
Jun 11, 2024

Conversation

AndriySvyryd
Copy link
Member

We need to use Azure.ResourceManager.CosmosDB to create and delete databases because these operations aren't supported by the data-plane Cosmos SDK with Managed Identities

@AndriySvyryd AndriySvyryd requested a review from a team June 11, 2024 04:25
@@ -223,10 +226,50 @@ private async Task CreateFromFile(DbContext context)
}
}

private static readonly ArmClient _armClient = new(TestEnvironment.TokenCredential);

public async Task<bool> EnsureCreatedAsync(DbContext context, CancellationToken cancellationToken = default)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to fall out of EF code completely here. Is there not a way to use CreateDatabaseIfNotExistsAsync or fix it so it can be used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do that we'd need to take a dependency on Azure.ResourceManager.CosmosDB and take resource group, subscription id, account name and AzureLocation as additional options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndriySvyryd Do we have an issue for that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DragosDanielBoia
Copy link

@dotnet-policy-service rerun

@AndriySvyryd AndriySvyryd merged commit dd9bc36 into main Jun 11, 2024
7 checks passed
@AndriySvyryd AndriySvyryd deleted the SecureCosmos branch June 11, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants