Skip to content

Simplify connect samples to only connect and read account metadata#9

Merged
seesharprun merged 3 commits into
mainfrom
copilot/simplify-connect-sample
Mar 19, 2026
Merged

Simplify connect samples to only connect and read account metadata#9
seesharprun merged 3 commits into
mainfrom
copilot/simplify-connect-sample

Conversation

Copilot AI commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Simplifies the connect samples in all languages to only connect to the account and perform a quick metadata read. CRUD operations (create/upsert/query) have been removed from both samples.

Changes

.NET (001-connect-passwordless)

  • Removed Newtonsoft.Json package dependency (no longer needed without item types)
  • Removed database creation, container creation, item upsert, and item read
  • Added client.ReadAccountAsync() to read and print the account name
  • Updated readme: role changed from Cosmos DB Built-in Data Contributor to Cosmos DB Built-in Data Reader; updated "What this sample does" description

Python (002-connect-connection-string)

  • Removed PartitionKey import (no longer needed)
  • Removed database creation, container creation, item upsert, and item query
  • Added client.get_database_account() to read and print the account name
  • Updated readme: updated "What this sample does" description

Copilot AI and others added 2 commits March 18, 2026 18:55
Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>
…ra ID compatibility

Co-authored-by: seesharprun <5067401+seesharprun@users.noreply.github.com>
Signed-off-by: Sidney Andrews <sidandrews@microsoft.com>
@seesharprun seesharprun marked this pull request as ready for review March 19, 2026 12:33
Copilot AI review requested due to automatic review settings March 19, 2026 12:33
@seesharprun seesharprun merged commit 3e7c190 into main Mar 19, 2026
6 checks passed
@seesharprun seesharprun deleted the copilot/simplify-connect-sample branch March 19, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 simplifies the Cosmos DB “connect” samples (Python and .NET) to perform only an account metadata read after connecting, removing all CRUD/database/container/item operations to keep the samples focused on connectivity validation.

Changes:

  • Python sample now only creates a CosmosClient, calls get_database_account(), and prints the account ID/name.
  • .NET sample now only creates a CosmosClient, calls ReadAccountAsync(), and prints the account ID/name.
  • READMEs updated to reflect the simplified behavior and (for .NET) the reduced required role.

Reviewed changes

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

File Description
python/002-connect-connection-string/app.py Removes CRUD logic and reads/prints account metadata only.
python/002-connect-connection-string/readme.md Updates “What this sample does” to match simplified behavior.
dotnet/001-connect-passwordless/connect.cs Removes CRUD logic and reads/prints account metadata only.
dotnet/001-connect-passwordless/readme.md Updates required role and “What this sample does” to match simplified behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants