Skip to content

CosmosDB: Add the 'EnableServerless' capability to accounts #9692

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

Merged
merged 5 commits into from
Jun 9, 2025

Conversation

Pilchie
Copy link
Member

@Pilchie Pilchie commented Jun 4, 2025

Description

Change Azure Cosmos DB accounts to be created with the "EnableServerless" capability. This is the recommended path for dev/test type scenarios, since it scales to zero when idle. See https://learn.microsoft.com/en-us/azure/cosmos-db/serverless for more details about it.

Fixes #8854

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@Copilot Copilot AI review requested due to automatic review settings June 4, 2025 20:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Azure Cosmos DB accounts to be created in serverless mode by introducing a new constant and updating the account configuration with the corresponding capability.

  • Added a new constant in CosmosConstants for the serverless capability.
  • Updated the AzureCosmosDBExtensions to include the "EnableServerless" capability when configuring Cosmos DB accounts.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Shared/Cosmos/CosmosConstants.cs Added a constant for the "EnableServerless" capability.
src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs Configured Cosmos DB accounts to include the serverless capability.

@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Jun 4, 2025
@Pilchie
Copy link
Member Author

Pilchie commented Jun 4, 2025

@davidfowl - care to take a look? Note this changes it unconditionally for all accounts. If we want to expose configuration I'll need some suggestions on what the right pattern is to do that.

@Pilchie
Copy link
Member Author

Pilchie commented Jun 4, 2025

Other note: I didn't actually run through provisioning with this. Would be great if someone could test a scenario known to work with Cosmos DB (or point me to one).

@davidfowl
Copy link
Member

@sebastienros should we add a WithDefaultSku like we did with sql ?

@Pilchie
Copy link
Member Author

Pilchie commented Jun 5, 2025

@davidfowl @sebastienros - please take another look.

@davidfowl
Copy link
Member

The one question I have is around subscription limitations with the serverless capability. Is it one per sub or something crazy like that?

@davidfowl davidfowl requested a review from sebastienros June 9, 2025 16:23
@Pilchie
Copy link
Member Author

Pilchie commented Jun 9, 2025

@davidfowl - We don't have subscription limits with the serverless capability. We do have a free account tier that is one per sub, but that is different than this.

@Pilchie
Copy link
Member Author

Pilchie commented Jun 9, 2025

Do you want me to merge, or do you want to?

@davidfowl
Copy link
Member

I was giving @sebastienros a chance to look but I will merge.

@davidfowl davidfowl merged commit d78b7a2 into dotnet:main Jun 9, 2025
496 of 498 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cosmos scales to $0 per month except with Aspire
2 participants