{"id":11772,"date":"2026-01-28T09:32:12","date_gmt":"2026-01-28T17:32:12","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=11772"},"modified":"2026-01-29T11:02:29","modified_gmt":"2026-01-29T19:02:29","slug":"github-copilot-cli-cosmos-db-agent-kit","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/github-copilot-cli-cosmos-db-agent-kit\/","title":{"rendered":"Accelerate Your Cosmos DB Infrastructure with GitHub Copilot CLI and Azure Cosmos DB Agent Kit"},"content":{"rendered":"<p data-start=\"63\" data-end=\"547\">Modern infrastructure work is increasingly agent driven, but only if your AI actually understands the platform you\u2019re deploying. This guide shows how to turn GitHub Copilot CLI into an Azure Cosmos DB aware infrastructure expert by loading the Azure Cosmos DB Agent Kit. In under a minute, you\u2019ll give Copilot deep, opinionated knowledge of Azure Cosmos DB best practices so it can review, generate, and optimize your Terraform, Bicep, Docker, and CI\/CD configurations directly from your terminal.<\/p>\n<h2>TL;DR \u2014 Get Started in 30 Seconds<\/h2>\n<pre><code>npx skills add AzureCosmosDB\/cosmosdb-agent-kit<\/code><\/pre>\n<pre><code>copilot\r\n&gt; Review my Terraform config for Azure Cosmos DB multi-region best practices:\r\n&gt; @infra\/main.tf<\/code><\/pre>\n<p><strong>That&#8217;s it!<\/strong> Copilot CLI now has expert-level Azure Cosmos DB infrastructure knowledge for your IaC workflows.<\/p>\n<p><center><iframe src=\"\/\/www.youtube.com\/embed\/Vi9-HIBwOh4\" width=\"560\" height=\"314\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/center><\/p>\n<h2>What is GitHub Copilot CLI?<\/h2>\n<p><a href=\"https:\/\/docs.github.com\/copilot\/concepts\/agents\/about-copilot-cli\" target=\"_blank\" rel=\"noopener\">GitHub Copilot CLI<\/a> is a terminal-native AI coding agent that brings the full power of GitHub Copilot to your command line. Unlike browser-based tools, it works directly in your development environment with full context awareness.<\/p>\n<h3>Key Capabilities<\/h3>\n<table>\n<thead>\n<tr>\n<th>Feature<\/th>\n<th>What it does for Infrastructure Engineers<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Agentic coding<\/strong><\/td>\n<td>Generate, review, and refactor Terraform, Bicep, and Docker configs<\/td>\n<\/tr>\n<tr>\n<td><strong>File system access<\/strong><\/td>\n<td>Read and modify IaC modules, Dockerfiles, and CI\/CD pipelines<\/td>\n<\/tr>\n<tr>\n<td><strong>Terminal execution<\/strong><\/td>\n<td>Run terraform plan, docker build, az cli commands directly<\/td>\n<\/tr>\n<tr>\n<td><strong>Git integration<\/strong><\/td>\n<td>Commit infrastructure changes, manage feature branches<\/td>\n<\/tr>\n<tr>\n<td><strong>MCP support<\/strong><\/td>\n<td>Connect to Azure Resource Graph, state backends, and registries<\/td>\n<\/tr>\n<tr>\n<td><strong>Agent Skills<\/strong><\/td>\n<td>Load domain-specific knowledge (Azure Cosmos DB best practices)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Installation<\/h3>\n<p><strong>Windows:<\/strong><\/p>\n<pre><code>winget install GitHub.Copilot<\/code><\/pre>\n<p><strong>macOS\/Linux:<\/strong><\/p>\n<pre><code>brew install copilot-cli\r\n# or\r\ncurl -fsSL https:\/\/gh.io\/copilot-install | bash<\/code><\/pre>\n<p>Launch with:<\/p>\n<pre><code>copilot<\/code><\/pre>\n<h2>Quick Setup<\/h2>\n<h3>Prerequisites<\/h3>\n<ol>\n<li><strong>GitHub Copilot CLI<\/strong> installed and authenticated<\/li>\n<li><strong>Active Copilot subscription<\/strong> (Pro, Pro+, Business, or Enterprise)<\/li>\n<li><strong>Version 0.0.390+<\/strong> \u2014 Run <code>copilot --version<\/code> to check<\/li>\n<\/ol>\n<h3>Install the Skill<\/h3>\n<p><strong>Option 1: One command (recommended)<\/strong><\/p>\n<pre><code>npx skills add AzureCosmosDB\/cosmosdb-agent-kit<\/code><\/pre>\n<p><strong>Option 2: Manual install<\/strong><\/p>\n<pre><code>git clone https:\/\/github.com\/AzureCosmosDB\/cosmosdb-agent-kit.git\r\nmkdir -p ~\/.copilot\/skills\r\ncp -r cosmosdb-agent-kit\/skills\/cosmosdb-best-practices ~\/.copilot\/skills\/<\/code><\/pre>\n<p><strong>Option 3: Project-level (team sharing)<\/strong><\/p>\n<pre><code>mkdir -p .github\/skills\r\ncp -r cosmosdb-agent-kit\/skills\/cosmosdb-best-practices .github\/skills\/\r\ngit add .github\/skills &amp;&amp; git commit -m \"Add Cosmos DB skill\"<\/code><\/pre>\n<h3>Verify Installation<\/h3>\n<pre><code>copilot\r\n&gt; What's wrong with enabling multiple_write_locations without proper conflict resolution?<\/code><\/pre>\n<p>\u2705 <strong>Skill loaded:<\/strong> Mentions conflict resolution policies, Last Writer Wins, custom stored procedures\n\u274c <strong>Skill not loaded:<\/strong> Generic advice about multi-region databases<\/p>\n<h2>Example: Review Terraform Configuration<\/h2>\n<p>Use Copilot CLI to review your Azure Cosmos DB Terraform modules for infrastructure anti-patterns.<\/p>\n<p><strong>Prompt:<\/strong><\/p>\n<pre><code>@infra\/cosmosdb\/main.tf\r\n\r\nReview this Terraform config for Cosmos DB best practices:\r\n- Multi-region setup\r\n- Consistency policy\r\n- Throughput configuration\r\n- Backup settings<\/code><\/pre>\n<p>Copilot CLI reads the file directly and applies the skill&#8217;s 45+ rules to identify issues like:<\/p>\n<ul>\n<li>Missing zone redundancy for 99.995% SLA<\/li>\n<li>Incorrect consistency level for the use case<\/li>\n<li>Fixed throughput instead of autoscale<\/li>\n<li>Missing automatic failover configuration<\/li>\n<li>Suboptimal partition key strategy<\/li>\n<\/ul>\n<h2>Example: Generate Terraform Module<\/h2>\n<p>Generate production-ready Azure Cosmos DB Terraform configuration.<\/p>\n<p><strong>Prompt:<\/strong><\/p>\n<pre><code>Generate a Terraform module for Cosmos DB with:\r\n- Multi-region deployment (East US primary, West US secondary)\r\n- Zone redundancy enabled\r\n- Autoscale throughput 400-4000 RU\/s\r\n- Hierarchical partition key support\r\n- Continuous backup with 7-day retention<\/code><\/pre>\n<p><strong>What Copilot generates:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Configuration<\/th>\n<th>Best Practice Applied<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>automatic_failover_enabled = true<\/code><\/td>\n<td>High availability<\/td>\n<\/tr>\n<tr>\n<td><code>zone_redundant = true<\/code><\/td>\n<td>99.995% SLA<\/td>\n<\/tr>\n<tr>\n<td><code>partition_key_version = 2<\/code><\/td>\n<td>Hierarchical partition keys<\/td>\n<\/tr>\n<tr>\n<td><code>backup.type = \"Continuous\"<\/code><\/td>\n<td>Point-in-time restore<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Save directly to your infra directory:<\/p>\n<pre><code>&gt; Write that to infra\/modules\/cosmosdb\/main.tf<\/code><\/pre>\n<h2>Example: Docker Compose with Azure Cosmos DB Emulator<\/h2>\n<p>Generate local development infrastructure using the Cosmos DB emulator.<\/p>\n<p><strong>Prompt:<\/strong><\/p>\n<pre><code>Generate a docker-compose.yml for local development with:\r\n- Cosmos DB emulator container\r\n- My .NET API container that connects to it\r\n- Proper networking and health checks\r\n- Environment variables for connection strings<\/code><\/pre>\n<p>Copilot generates the complete Docker Compose configuration:<\/p>\n<pre><code>&gt; Save that to docker-compose.dev.yml<\/code><\/pre>\n<h2>Example: Review Indexing Policy for IaC<\/h2>\n<p>Optimize the indexing policy defined in your Terraform or Bicep configuration.<\/p>\n<p><strong>Prompt:<\/strong><\/p>\n<pre><code>@infra\/cosmosdb\/main.tf\r\n\r\nMy container queries by tenantId, status, and orders by createdAt.\r\nReview and optimize the indexing_policy block for these query patterns.<\/code><\/pre>\n<p><strong>What Copilot suggests:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Optimization<\/th>\n<th>Impact<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Add composite index <code>(tenantId, createdAt DESC)<\/code><\/td>\n<td>Efficient ORDER BY<\/td>\n<\/tr>\n<tr>\n<td>Exclude <code>\/payload\/*<\/code> from indexing<\/td>\n<td>Reduce storage costs<\/td>\n<\/tr>\n<tr>\n<td>Use <code>included_path<\/code> instead of wildcard<\/td>\n<td>Lower RU for writes<\/td>\n<\/tr>\n<tr>\n<td>Add spatial index if using geo queries<\/td>\n<td>Enable geo-filtering<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Example: CI\/CD Pipeline Integration<\/h2>\n<p>Generate GitHub Actions workflow for Cosmos DB infrastructure deployment.<\/p>\n<p><strong>Prompt:<\/strong><\/p>\n<pre><code>Generate a GitHub Actions workflow that:\r\n- Runs terraform plan on PRs\r\n- Runs terraform apply on merge to main\r\n- Uses OIDC authentication to Azure\r\n- Has separate jobs for dev\/staging\/prod environments<\/code><\/pre>\n<p>Copilot generates the workflow and can write it directly:<\/p>\n<pre><code>&gt; Write that to .github\/workflows\/infra-deploy.yml<\/code><\/pre>\n<h2>Example: Bicep Module Review<\/h2>\n<p>Review Azure Bicep configurations for Azure Cosmos DB best practices.<\/p>\n<p><strong>Prompt:<\/strong><\/p>\n<pre><code>@infra\/cosmosdb.bicep\r\n\r\nReview this Bicep module for:\r\n- Proper use of parameters vs variables\r\n- Security best practices (private endpoints, managed identity)\r\n- Cost optimization settings<\/code><\/pre>\n<h2>Tips for Effective Prompts<\/h2>\n<table>\n<thead>\n<tr>\n<th>Technique<\/th>\n<th>Example<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Reference IaC files with @<\/strong><\/td>\n<td><code>@infra\/main.tf Review this for multi-region best practices<\/code><\/td>\n<\/tr>\n<tr>\n<td><strong>Be specific about concerns<\/strong><\/td>\n<td>&#8220;Review for HA and DR settings&#8221; vs &#8220;Review this config&#8221;<\/td>\n<\/tr>\n<tr>\n<td><strong>Chain actions<\/strong><\/td>\n<td>&#8220;Generate the module, then write it to infra\/modules\/cosmosdb\/&#8221;<\/td>\n<\/tr>\n<tr>\n<td><strong>Ask for explanations<\/strong><\/td>\n<td>Add &#8220;&#8230;and explain the tradeoffs&#8221; for architecture decisions<\/td>\n<\/tr>\n<tr>\n<td><strong>Include constraints<\/strong><\/td>\n<td>&#8220;&#8230;with budget under $500\/month&#8221; or &#8220;&#8230;for dev environment&#8221;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Troubleshooting<\/h2>\n<table>\n<thead>\n<tr>\n<th>Problem<\/th>\n<th>Solution<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Skill not loading<\/td>\n<td>Update CLI: <code>winget upgrade GitHub.Copilot<\/code><\/td>\n<\/tr>\n<tr>\n<td>Generic responses<\/td>\n<td>Verify skill exists: <code>ls ~\/.copilot\/skills\/cosmosdb-best-practices\/<\/code><\/td>\n<\/tr>\n<tr>\n<td>Still not working<\/td>\n<td>Try project-level install in <code>.github\/skills\/<\/code><\/td>\n<\/tr>\n<tr>\n<td>Need latest rules<\/td>\n<td>Re-run: <code>npx add-skill AzureCosmosDB\/cosmosdb-agent-kit<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<div>\n<h2>Learn Cosmos DB Visually<\/h2>\n<div>Prefer learning through visuals? Check out the <a href=\"https:\/\/sajeetharan.github.io\/cosmos-graphic\/\">Azure Cosmos DB Visual Storybook\u00a0<\/a> an interactive collection of infographics covering everything from the basics to advanced AI integration. It&#8217;s a great companion to the agent-kit, helping you understand why the best practices exist before Copilot applies them to your code.<\/div>\n<\/div>\n<h2>Resources<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/AzureCosmosDB\/cosmosdb-agent-kit\" target=\"_blank\" rel=\"noopener\">Azure Cosmos DB Agent Kit<\/a><\/li>\n<li><a href=\"https:\/\/docs.github.com\/copilot\/concepts\/agents\/about-copilot-cli\" target=\"_blank\" rel=\"noopener\">GitHub Copilot CLI Documentation<\/a><\/li>\n<li><a href=\"https:\/\/agentskills.io\/\" target=\"_blank\" rel=\"noopener\">Agent Skills Specification<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/\" target=\"_blank\" rel=\"noopener\">Azure Cosmos DB Documentation<\/a><\/li>\n<li><a href=\"https:\/\/registry.terraform.io\/providers\/hashicorp\/azurerm\/latest\/docs\/resources\/cosmosdb_account\" target=\"_blank\" rel=\"noopener\">Terraform AzureRM Cosmos DB Provider<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/emulator\" target=\"_blank\" rel=\"noopener\">Azure Cosmos DB Emulator (Docker)<\/a><\/li>\n<\/ul>\n<h2>Leave a Review<\/h2>\n<p>Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and get a $50 gift.\u00a0<a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/azure-cosmos-db-agent-kit-ai-coding-assistants\/#\">Get started here<\/a>.<\/p>\n<h2 id=\"about-azure-cosmos-db\"><strong>About Azure Cosmos DB<\/strong><\/h2>\n<p>Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.<\/p>\n<p>To stay in the loop on Azure Cosmos DB updates, follow us on\u00a0<a href=\"https:\/\/twitter.com\/AzureCosmosDB\" target=\"_blank\" rel=\"noopener\">X<\/a>,\u00a0<a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>, and\u00a0<a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\" target=\"_blank\" rel=\"noopener\">LinkedIn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Modern infrastructure work is increasingly agent driven, but only if your AI actually understands the platform you\u2019re deploying. This guide shows how to turn GitHub Copilot CLI into an Azure Cosmos DB aware infrastructure expert by loading the Azure Cosmos DB Agent Kit. In under a minute, you\u2019ll give Copilot deep, opinionated knowledge of Azure [&hellip;]<\/p>\n","protected":false},"author":80443,"featured_media":11781,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1610,14],"tags":[1986,1236,1988,1995,1992],"class_list":["post-11772","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-core-sql-api","tag-agentkit","tag-ai","tag-githubcopilot","tag-githubcopilotcli","tag-skills"],"acf":[],"blog_post_summary":"<p>Modern infrastructure work is increasingly agent driven, but only if your AI actually understands the platform you\u2019re deploying. This guide shows how to turn GitHub Copilot CLI into an Azure Cosmos DB aware infrastructure expert by loading the Azure Cosmos DB Agent Kit. In under a minute, you\u2019ll give Copilot deep, opinionated knowledge of Azure [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/80443"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=11772"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11772\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/11781"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=11772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=11772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=11772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}