Skip to content

Instantly share code, notes, and snippets.

@mayur-tendulkar
Created December 25, 2018 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayur-tendulkar/233ad535e2797450b8ba0e230fc5245f to your computer and use it in GitHub Desktop.
Save mayur-tendulkar/233ad535e2797450b8ba0e230fc5245f to your computer and use it in GitHub Desktop.
Create VM using Fluent API
var windowsVM = azure.VirtualMachines.Define("myWindowsVM")
.WithRegion(Region.US_EAST)
.WithNewResourceGroup(rgName)
.WithNewPrimaryNetwork("10.0.0.0/28")
.WithPrimaryPrivateIpAddressDynamic()
.WithNewPrimaryPublicIpAddress("mywindowsvmdns")
.WithPopularWindowsImage(KnownWindowsVirtualMachineImage.WINDOWS_SERVER_2012_R2_DATACENTER)
.WithAdminUserName("tirekicker")
.WithPassword(password)
.WithSize(VirtualMachineSizeTypes.StandardD3V2)
.Create();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment