跳到正文

.NET Core (C#, VB, F#) ​

Pulumi supports infrastructure as code using any .NET Core language. You can use your favorite .NET tools — such as editors, package managers, build systems, and test frameworks — to create, deploy, and manage infrastructure on any cloud, including Azure, AWS, and Google Cloud.

INSTALL .NET CORE

Getting Started ​

The fastest way to get up and running is to choose from one of the following Getting Started guides:

AWS
Azure
Google Cloud
Kubernetes

The Getting Started guides currently only demonstrate C#. For F# and Visual Basic, they will work just fine — the guides simply aren't ready for them yet.

Prerequisites ​

Before using Pulumi for .NET, you will need to install both Pulumi and .NET Core SDK 3.1 or later. If you follow the Getting Started guides above, they will walk you through doing this.

  1. Install Pulumi
  2. Install .NET Core SDK 3.1

Example ​

C#, F#, and VB Templates ​

As of version 1.5, Pulumi supports .NET Core 3.1. You can write Pulumi programs in your favorite .NET language to get additional verification and tooling benefits. The fastest way to get started is to use a template. The template will autogenerate a set of files and initialize a Pulumi project. The getting started guides shown above will help do this on your cloud of choice, but this section describes doing so independently.

.NET Core Tools ​

Pulumi packages are distributed on NuGet for download.

Although you can use any editor, Visual Studio Code, Visual Studio, or Rider will deliver full tooling support for .NET Core out-of-the-box, including auto-completion, red error markers and build errors.

VSCode

Pulumi Programming Model ​

The Pulumi programming model includes a core concept of Input and Output values, which are used to track how outputs of one resource flow in as inputs to another resource. This concept is important to understand when getting started with .NET and Pulumi, and the Inputs and Outputs documentation is recommended to get a feel for how to work with this core part of Pulumi in common cases.

Continuous Delivery ​

In addition to the CLI-driven workflows shown above, you can continuously deploy your infrastructure using .NET by integrating with your CI/CD provider of choice. This ensures automated deployments triggered by events such as commits to your Git repo.

Azure DevOps Pipelines ​

Pulumi can deploy infrastructure changes from your Azure DevOps Pipelines. This enables easy integration with your existing automation while using .NET Core for your infrastructure as code, leveraging the Pulumi task in the Visual Studio Marketplace.

To learn more, see the Pulumi Azure DevOps user guide.

GitHub Actions ​

Pulumi can deploy infrastructure using GitHub Actions, making Git-driven deployments of your infrastructure as code straightforward. To learn more, see the Pulumi GitHub Actions user guide.

There is also a Pulumi GitHub App that integrates with Pull Requests so that you get previews of deployments before they are merged inline in your PRs where it's easy to comment and collaborate.

Other CI/CD Integrations ​

If you don't use Azure DevOps or GitHub Actions, Pulumi also supports a number of other CI/CD integrations.

文档内容翻译自 Pulumi 官方文档。