C Create a VM autogenerated Create the resource
- Slides: 8
C# - Create a VM – auto-generated: // Create the resource group resource. Client. Resource. Groups. Create. Or. Update(“my. Resource. Group”, new Resource. Group { Location = "eastus"}); // Create the storage account Random r = new Random(); int postfix = 123; // r. Next(0, 1000000); var storage. Account. Name = String. Format("dotnetstor{1}", resource. Group. Name, postfix); var stor. Create. Params = new Storage. Account. Create. Parameters { Location = “eastus”, Sku = new Microsoft. Azure. Management. Storage. Models. Sku( Sku. Name. Premium. LRS, Sku. Tier. Premium), Kind = Microsoft. Azure. Management. Storage. Models. Kind. Storage, Encryption = new Encryption(new Encryption. Services( new Encryption. Service(false))), }; storage. Client. Storage. Accounts. Create(resource. Group. Name, storage. Account. Name, stor. Create. Params); // Create the virtual network var vnet. Create. Params = new Virtual. Network { Location = “eastus”, Address. Space = new Address. Space{ Address. Prefixes = new []{ "10. 0/16" } }, Dhcp. Options = new Dhcp. Options{ Dns. Servers = new []{ "8. 8" } }, Subnets = new List<Subnet>{ new Subnet{ Name = "dotnetsubnet", Address. Prefix = "10. 0/24" } } }; var vnet = network. Client. Virtual. Networks. Create. Or. Update( “my. Resource. Group”, "sample-dotnet-vnet", vnet. Create. Params); // Create the public IP var public. Ip. Create. Params = new Public. IPAddress { Location = “eastus”, Public. IPAllocation. Method = IPAllocation. Method. Dynamic, Dns. Settings = new Public. IPAddress. Dns. Settings{ Domain. Name. Label = "sample-dotnet-domain-name-label" } }; var pub. Ip = network. Client. Public. IPAddresses. Create. Or. Update(“my. Resource. Group”, "sample-dotnet-pubip", public. Ip. Create. Params); // Create the network interface var vnet. Nic. Create. Params = new Network. Interface { Location = “eastus”, Ip. Configurations = new List<Network. Interface. IPConfiguration>{ new Network. Interface. IPConfiguration { Name = "sample-dotnet-nic", Private. IPAllocation. Method = IPAllocation. Method. Dynamic, Subnet = vnet. Subnets. First(), Public. IPAddress = pub. Ip } } }; var nic = network. Client. Network. Interfaces. Create. Or. Update(“my. Resource. Group”, "sample-dotnet-nic", vnet. Nic. Create. Params); // Create the virtual machine var vm. Create. Params = new Virtual. Machine{ Location = “eastus”, Os. Profile = new OSProfile { Computer. Name = "sample-vm", Admin. Username = "not. Admin", Admin. Password = "Pa$$w 0 rd 92" }, Hardware. Profile = new Hardware. Profile{ Vm. Size = Virtual. Machine. Size. Types. Standard. DS 1 V 2 }, Storage. Profile = new Storage. Profile{ Image. Reference = new Image. Reference { Publisher = "Canonical", Offer = "Ubuntu. Server", Sku = "14. 04. 3 -LTS", Version = "latest" }, Os. Disk = new OSDisk { Name = "sample-os-disk", Caching = Caching. Types. None, Create. Option = Disk. Create. Option. Types. From. Image, Vhd = new Virtual. Hard. Disk{ Uri = String. Format( "https: //{0}. blob. core. windows. net/dotnetcontainer/dotnetlinux. vhd", storage. Account. Name) } } }, Network. Profile = new Network. Profile { Network. Interfaces = new List<Network. Interface. Reference>{ new Network. Interface. Reference { Id = nic. Id, Primary = true } }; var ssh. Pub. Location = Path. Get. Full. Path("~/. ssh/id_rsa. pub"); if(File. Exists(ssh. Pub. Location)){ vm. Create. Params. Os. Profile. Linux. Configuration = new Linux. Configuration { Disable. Password. Authentication = true, Ssh = new Ssh. Configuration{ Public. Keys = new List<Ssh. Public. Key>{ new Ssh. Public. Key{ Path = ssh. Pub. Location } }; } var vm = compute. Client. Virtual. Machines. Create. Or. Update( “my. Resource. Group”, "sample-dotnet-vm", vm. Create. Params);
C# - Create a VM – simpler: IVirtual. Machine linux. VM = azure. Virtual. Machines(). Define("my. Linux. VM"). With. Region(“eastus”). With. New. Resource. Group("my. Resource. Group"). With. New. Primary. Network("10. 0/28"). With. Primary. Private. Ip. Address. Dynamic(). With. New. Primary. Public. Ip. Address("mylinuxvmdns"). With. Popular. Linux. Image( Known. Linux. Virtual. Machine. Image. Ubuntu. Server 14_04_Lts). With. Root. User. Name("tirekicker"). With. Ssh(ssh. Key). With. Size(“Standard_D 3_v 2”). Create();
Demo
Samples – Azure Management Libraries for. NET https: //github. com/azure-sdk-for-net/tree/Fluent#sample-code manage virtual machines manage virtual networks manage virtual machine scale sets manage storage accounts manage virtual machine images manage network interfaces manage virtual machine extensions manage network security groups manage availability sets manage IP addresses Create multiple virtual machines in parallel manage load balancers Create multiple virtual machines with network in parallel Manage resources Manage resource groups deploy using ARM templates manage key vaults Microsoft Confidential manage batch accounts
Dev Survey: Azure services and features you would like to see supported soon? Provide your input@ http: //aka. ms/az-libs-for-net (< 5 minutes) Microsoft Confidential
Azure Management Libraries for. NET Developers can help • Give it a try !! https: //github. com/azure-sdk-for-net/tree/Fluent • File issues and open PRs in Git. Hub • Your input – http: //aks. ms/az-libs-for-net (< 5 minutes) Developers can share • https: //github. com/Azure/azure-sdk-for-net/tree/Fluent • https: //azure. microsoft. com/en-us/blog/simpler-azure-management-libraries-for-net/ Microsoft Confidential
- Contoh resource loading
- Resource leveling is the approach to even out the peaks of
- What is a resource loading chart
- How to create a resource loading chart
- A resource loading chart displays:
- How to create a resource loading chart
- Jika noel(create(q)) adalah 0 maka front(create(q)) adalah
- Thể thơ truyền thống
- Các châu lục và đại dương trên thế giới