# Kimi K2.7 Code is Now Available in Microsoft Foundry

> Source: <https://dev.to/taswar_bhatti/kimi-k27-code-is-now-available-in-microsoft-foundry-l7b>
> Published: 2026-07-31 09:26:32+00:00

There are a lot of AI model announcements these days. But every now and then one lands that feels immediately practical for real engineering work.

Kimi K2.7 Code from Moonshot AI showing up in Microsoft Foundry feels like one of those releases.

Microsoft and Moonshot AI have made Kimi K2.7 Code available in the Foundry model catalog starting July 1, 2026. It is designed for the kind of software engineering that does not happen in a single prompt — multi-file refactors, feature work spanning multiple services, debugging sessions that need to hold context across many steps.

That is a different problem space from "generate a todo app in one shot." And honestly, that is where most development teams are today.

Kimi K2.7 Code is a coding-focused model from Moonshot AI. It builds on the K2.6 series with three focused improvements:

The 256K context window is the other number worth noting. Large codebases, long refactoring sessions, multiple files in context at once — that is the use case this model is optimized for.

Here is how K2.7 Code stacks up against K2.6 and two frontier models:

| Benchmark | Kimi K2.6 | Kimi K2.7 Code |
GPT-5.5 | Claude Opus 4.8 |
|---|---|---|---|---|
| Kimi Code Bench v2 | 50.9 | 62.0 |
69.0 | 67.4 |
| Program Bench | 48.3 | 53.6 |
69.1 | 63.8 |
| MLS Bench Lite | 26.7 | 35.1 |
35.5 | 42.8 |
| MCP Atlas | 69.4 | 76.0 |
79.4 | 81.3 |
MCP Mark Verified |
72.8 | 81.1 |
92.9 | 76.4 |

A few things worth flagging:

The Kimi Code Bench numbers are Moonshot AI's own benchmark — take those as directional. MCP Mark Verified is human-verified and more credible for independent comparison. On that benchmark, K2.7 Code at **81.1** actually beats Claude Opus 4.8 at 76.4. That is the benchmark most relevant to agentic coding workflows with tool use.

On pure coding tasks (Program Bench, MLS Bench Lite), it sits between GPT-5.5 and Claude Opus 4.8. That is a reasonable position for a model priced at $0.95 input / $4.00 output per million tokens.

| Input / 1M tokens | Output / 1M tokens | Cached Input | |
|---|---|---|---|
| Kimi K2.7 Code | $0.95 | $4.00 | $0.19 |

At $0.95 input, this sits below GPT-4o-class pricing. For long-running coding tasks that consume a lot of output tokens, $4.00/M output is the number to watch. Cached input at $0.19 helps when you are repeatedly loading the same large codebase context.

If you are evaluating this model, here is where it fits:

That is a pretty specific profile. This is not a general-purpose chatbot. It is a model built for developer tooling and autonomous coding agents.

Here is a working .NET console app that calls Kimi K2.7 Code through Azure AI Foundry. I am using the Azure AI Inference SDK and DefaultAzureCredential — no API key hardcoded.

Code also located at (Github|[https://github.com/taswar/KimiFoundryDemo](https://github.com/taswar/KimiFoundryDemo))

```
dotnet new console -n KimiFoundryDemo
cd KimiFoundryDemo
dotnet add package Azure.AI.Inference --prerelease
dotnet add package Azure.Identity
```

Set your environment variables:

```
# On Windows (PowerShell)
$env:AZURE_AI_CHAT_ENDPOINT="https://YOURRESOURCE.services.ai.azure.com/models"
az login
$env:AZURE_AI_MODEL = "kimi-k2-7-code"
using Azure.Identity;
using Azure;
using Azure.AI.Inference;
using Azure.Core;

var endpoint = Environment.GetEnvironmentVariable("AZURE_AI_CHAT_ENDPOINT")
    ?? throw new InvalidOperationException("Set AZURE_AI_CHAT_ENDPOINT environment variable.");

var model = Environment.GetEnvironmentVariable("AZURE_AI_MODEL") ?? "Kimi-K2.7-Code";

// DefaultAzureCredential handles Entra ID auth — no API key in code.
// Sign in first with: az login
var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions
{
    ExcludeManagedIdentityCredential = true
});

// Foundry (Cognitive Services) endpoints require a token whose audience is
// https://cognitiveservices.azure.com. Force that scope regardless of the
// scope the Azure.AI.Inference SDK requests by default.
var scopedCredential = new ScopeOverrideCredential(
    credential, "https://cognitiveservices.azure.com/.default");

var client = new ChatCompletionsClient(new Uri(endpoint), scopedCredential);

var options = new ChatCompletionsOptions
{
    Model = model,
    Temperature = 0.2f,
    MaxTokens = 2000
};

options.Messages.Add(new ChatRequestSystemMessage(
    """
    You are a senior .NET architect.
    Your job is to review code and identify issues clearly and concisely.
    Be direct. Prioritize correctness over style.
    Return findings as a numbered list with severity: critical, warning, or info.
    """));

options.Messages.Add(new ChatRequestUserMessage(
    """
    Review the following C# method and identify any issues:

    public async Task GetUserAsync(int userId)
    {
        var user = await _dbContext.Users
            .Where(u => u.Id == userId)
            .FirstOrDefault();

        return user;
    }
    """));

Console.WriteLine($"Calling model: {model}");
Console.WriteLine("---");

Response<ChatCompletions> response = client.Complete(options);
System.Console.WriteLine(response.Value.Content);

// Wraps a TokenCredential and forces a fixed audience/scope, ignoring the
// scope the client pipeline asks for.
sealed class ScopeOverrideCredential : TokenCredential
{
    private readonly TokenCredential _inner;
    private readonly string[] _scopes;

    public ScopeOverrideCredential(TokenCredential inner, string scope)
    {
        _inner = inner;
        _scopes = new[] { scope };
    }

    public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
        => _inner.GetToken(new TokenRequestContext(_scopes), cancellationToken);

    public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
        => _inner.GetTokenAsync(new TokenRequestContext(_scopes), cancellationToken);
}
```

Something like:

```
Calling model: kimi-k2-7-code
---
1. **Critical — `Task` return type does not match returned value**  
   The method returns `user`, but the signature returns non-generic `Task`. Change it to `Task<User?>` (or `Task<User>` if nullability is disabled).

2. **Critical — Synchronous `FirstOrDefault` used in an async method**  
   `.FirstOrDefault()` executes the query synchronously and is not awaitable. Use `.FirstOrDefaultAsync()` (and pass a `CancellationToken`).

3. **Warning — Missing `CancellationToken`**  
   Async methods should accept `CancellationToken cancellationToken = default` and forward it to `FirstOrDefaultAsync(cancellationToken)`.

4. **Info — Consider `FindAsync` for primary-key lookups**  
   Since the query is by primary key, `_dbContext.Users.FindAsync(userId, cancellationToken)` is more idiomatic and can be faster due to EF change-tracker short-circuiting.
```

That is the kind of output you want from a code review tool — specific, actionable, severity-tagged.

If you are already in Azure, Foundry gives you a few things you do not get with a direct Moonshot API key:

That last point matters more than it sounds. The jump from "I tried this in a notebook" to "this is running in our CI pipeline" is usually infrastructure, not capability. Foundry removes that friction.

Kimi K2.7 Code in Microsoft Foundry is interesting for developers because it is not just a benchmark improvement. It is a model positioned for the kind of work that is genuinely hard to automate well: long-running, multi-step, multi-file engineering tasks.

The MCP Mark Verified score beating Claude Opus 4.8 is the number I would keep an eye on as agentic coding workflows mature. If your team is building AI-assisted developer tooling or coding agents, this is one worth evaluating.

If you are already on Azure AI Foundry, the model is in the catalog now. Start with the C# code above, swap in your own endpoint, and run it against a real method from your codebase. That will tell you more than any benchmark.
