ASP.NET Core sample app illustrating how to use the Steeltoe CosmosDB Connector for connecting to a CosmosDB database.
- Installed .NET 8 SDK
- Optional: VMware Tanzu Platform for Cloud Foundry (optionally with Windows support) with VMware Tanzu Cloud Service Broker and Cloud Foundry CLI
- Start the Azure CosmosDB Emulator
- Update your local primary key in
appsettings.development.json
atSteeltoe:Client:CosmosDb:Default:ConnectionString
- Run the sample
dotnet run
Upon startup, the app inserts a couple of objects into the bound CosmosDB database. They are displayed on the home page.
- Create a CosmosDB service instance in an org/space
cf target -o your-org -s your-space cf create-service csb-azure-cosmosdb-sql small sampleCosmosDbService
- Wait for the service to become ready (you can check with
cf services
) - Run the
cf push
command to deploy from source (you can monitor logs withcf logs cosmosdb-connector-sample
)- When deploying to Windows, binaries must be built locally before push. Use the following commands instead:
dotnet publish -r win-x64 --self-contained cf push -f manifest-windows.yml -p bin/Release/net8.0/win-x64/publish
- When deploying to Windows, binaries must be built locally before push. Use the following commands instead:
- Copy the value of
routes
in the output and open in your browser
See the Official Steeltoe Connectors Documentation for a more in-depth walkthrough of the samples and more detailed information.