As the Azure SDK team’s role has evolved from authoring client libraries to building tools and processes that empower Azure service teams, delivering a polished, consistent developer experience has become increasingly important.
Today, code generation sits at the heart of our strategy, yet the current tooling presents significant challenges outside of the golden path. Specifically, there is a disconnect between TypeSpec—our abstract service contract definition—and the idiomatic .NET code we aim to produce. While the generator handles simple conversions automatically, more complex scenarios often lead to confusing failures that block key steps like generating an API View for architectural review.
To address this, we propose building an integrated set of tools that:
-
Automatically apply default fixes during generation, enabling partners to run the generator once and successfully produce an API View.
-
Detect and help resolve .NET-specific issues earlier, during TypeSpec authoring, through a linter and automated fixes.
-
Support local and CI workflows across command line, Visual Studio, and Visual Studio Code.
-
Provide a guided, interactive mode to reduce upfront configuration and improve usability.
This approach will enable Azure service teams to deliver high-quality .NET client libraries more efficiently and consistently, while reducing friction and dependence on deep architectural intervention.
As the Azure SDK team has evolved, we’ve shifted from primarily writing client libraries to building the processes and tools that empower our Azure service partners. Delivering polished, robust tools that help these teams succeed has become increasingly important.
Code generation is central to our strategy, but the current tooling offers a rough developer experience outside the golden path. A recurring challenge is the disconnect between TypeSpec—which models the service contract abstractly—and the generated .NET library code. Some names and concepts valid in the service definition, or in other client languages, are not idiomatic in .NET. While the generator handles straightforward, rule-based conversions automatically, more nuanced cases often require architectural review. Failures during this process can be overwhelming and difficult to resolve, and they block the creation of an API View, which is essential for architect discussions.
-
Allow partners to run the generator once to achieve a successful outcome, automatically applying default fixes for .NET rule failures. At the end of the run, it should always be possible to produce an API View for architect discussions.
-
Provide early detection of .NET rule failures during TypeSpec authoring, flagging issues and offering automatic fixes as TypeSpec is written. This enables partners to address problems early and avoids unexpected failures during generation.
-
Support local use of the tooling via the command line, as an MCP tool usable in Visual Studio Code and Visual Studio, and integrated with the REST API specs repository flows.
-
Ensure a consistent experience for generating both data plane and management Azure libraries.
-
Deep API analysis and adjustments that would obviate the need for archiect review. The adjustments made by the agent are intended to be good enough to comply with guidelines, but will still require architect review.
-
Providing an unbranded or generic experience. These tools are explicitly built for Azure scenarios and intended for use by Azure service teams developing client libraries.
-
Deep integration into the broader TypeSpec ecosystem. The tools are focused on the Azure code generation workflow and will integrate specifically with Azure engineering systems and tooling.
-
Supporting the legacy AutoRest generator. The tools will integrate only with the .NET TypeSpec generator (MTG).
-
Build a generator agent that orchestrates the TypeSpec toolchain for .NET library generation. The agent will detect .NET rule failures and generator errors, and iteratively apply automatic fixes until generation succeeds or it can no longer make progress.
-
Develop a Visual Studio Code extension to lint TypeSpec as it’s authored, detecting .NET rule failures and offering automatic fixes. This gives partners immediate feedback and helps prevent failures later in the generation process.
-
Add an interactive mode to the generator agent that guides users through simple, step-by-step questions, reducing the need to configure the generator in advance.
-
Expose an MCP interface so the generator agent can integrate with Visual Studio, Visual Studio Code, and the REST API specs pipeline.
-
When run interactively, have the generator agent detect missing TypeSpec tooling in the environment and offer to install it automatically.
-
The names used in this document are intended for illustration only. Some names are not ideal and will need to be refined during discussions.
-
Some details not related to the core agent areas are not illustrated; the scope of this is limited to the high level shape and paradigms for the feature area.
-
Fake methods are used to illustrate "something needs to happen, but the details are unimportant." As a general rule, if an operation is not directly related to one of the core types, it can likely be assumed that it is for illustration only. These methods will most often use ellipses for the parameter list, in order to help differentiate them.
-
This document is focused on the .NET generator agent and shared infrastructure. The VS Code plugin for linting TypeSpec will be detailed by Arthur and team, who will be driving its design and development.
-
Azure partners using the generator agent have followed the Contributing Guide, forking the repository and ensuring that they have a basic .NET development environment available as a prerequisite.
-
All Azure partners belong to a common security group such that we can grant them access to interact with an Azure AI Fountry Agent as part of the generation process when running locally in non-MCP mode.
The generator agent will be packaged as a .NET tool and published to the Azure tools NuGet feed, following the same pattern as our snippet generator. This allows partners to install it using the standard dotnet
CLI similar to:
> dotnet tool install -g Azure.Tools.GeneratorAgent
For more context, see: dotnet tool install and Create a .NET tool.
To generate an Azure library with an existing configuration, the tool invoked similar to the existing generator today:
> dotnet tool run generate ../my-service.tsp --out-dir ./
====================================
| Azure SDK for .NET Generator Agent |
====================================
Compiling TypeSpec... success!
Generating .NET library... success!
Building the library... FAIL
warning AZC0030: Model name 'DiskOptions' ends with 'Options'. This makes Krzysztof sad
and he will not send you a holiday card. Please rename 'DiskOptions' according to our guidleines
at https://bad.errormessage.contoso.com.
warning AZC0030: Model name 'PersonOptions' ends with 'Options'. This makes Krzysztof sad
and he will not send you a holiday card. Please rename 'PersonOptions' according to our guidleines
at https://bad.errormessage.contoso.com.
warning AZC0012: Single word class names are bad and you should feel bad. Please rename `Fruit` to
a more suitable name according to our guidelines at https://bad.errormessage.contoso.com.
Attempting to fix AZC0030 failures.... success!
Attempting to fix AZC0012 failures.... success!
Compiling TypeSpec... success!
Generating .NET library... success!
Building the library... success!
Your library was successfully generated in `/sdk/Contoso/Azure.ResourceManager.Contoso`
To generate an Azure library, a TypeSpec configuration file must be available, containing the Azure context for the type of library that you'd like to emit. This can make getting started a burden, as partners need to understand what specific information is needed and how that is represented in configuration.
To improve this experience, the generator agent offers an interactive mode that provides a guided experience to gather information and create the needed configuration. This flow looks something like:
> dotnet tool run generate --interactive
====================================
| Azure SDK for .NET Generator Agent |
====================================
Found TypeSpec file my-service.tsp in the current directory.
If this is not the spec that you would like to generate,
where is the spec that should be used? (blank for ./my-service.tsp)
>
(using ./my-service.tsp)
Are you generating a:
[1] Client library (data plane)
[2] Management library
> 2
What is the name of your service? (example: Compute)
> Contoso
Do you want to generate tests?
[Y] Yes
[N] No
> Y
Do you want to generate samples?
[Y] Yes
[N] No
> Y
Where should we write the configuration to? (blank for the current directory)
>
(using current directory)
Writing tspconfig.yaml... success!
Do you want to generate the library now?
[Y] Yes
[N] No
> Y
Compiling TypeSpec... success!
Generating .NET library... success!
Building the library... success!
Your library was successfully generated in `/sdk/Contoso/Azure.ResourceManager.Contoso`
To generate an Azure library with an existing configuration, the tool invoked similar to the existing generator today:
> dotnet tool run generate ../my-service.tsp --out-dir ./
====================================
| Azure SDK for .NET Generator Agent |
====================================
The TypeSpec compiler and toolchain is not detected!
Would you like ti install it now?
[Y] Yes
[N] No
> N
Without the TypeSpec compiler and toolchain, generation cannot continue. To manually install,
please see: https://typespec.io/docs/
<< TBD >>
Lots of unknowns here still. Will be fleshed out later.