Azure virtual machine libraries for .NET

Overview

On-demand, scalable computing resources running Linux or Windows.

To get started with Azure virtual machines, see Create a Linux virtual machine with the Azure portal.

Management APIs

Create, configure, and scale out Windows and Linux virtual machines in Azure from your code with the management API.

Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio Package Manager

Install-Package Microsoft.Azure.Management.Compute.Fluent

.NET Core CLI

dotnet add package Microsoft.Azure.Management.Compute.Fluent

Code Example

Create a Windows VM.

/* Include these "using" directives...
using Microsoft.Azure.Management.Compute.Fluent;
using Microsoft.Azure.Management.Compute.Fluent.Models;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
*/

IVirtualMachine windowsVM = azure.VirtualMachines.Define("MyVirtualMachine")
    .WithRegion(Region.USEast)
    .WithNewResourceGroup("MyResourceGroup")
    .WithNewPrimaryNetwork("10.0.0.0/28")
    .WithPrimaryPrivateIPAddressDynamic()
    .WithNewPrimaryPublicIPAddress("MyIPAddressLabel")
    .WithPopularWindowsImage(KnownWindowsVirtualMachineImage.WindowsServer2012R2Datacenter)
    .WithAdminUsername("UserName")
    .WithAdminPassword("Password")
    .WithSize(VirtualMachineSizeTypes.StandardD3V2)
    .Create();

Samples

View the complete list of virtual machine samples.