Quantcast
Channel: Azure Virtual Machines forum
Viewing all articles
Browse latest Browse all 12545

Creating VMs via Azure .Net API - how to enable RDP?

$
0
0

I'm currently working on some proof of concept work for creating and deploying cloud services and virtual machines from code (currently using the .NET Azure Management API).  I've so far managed to put code together to deploy a cloud service package but have run into an issue whilst creating a test VM. Basically I cannot figure out how to create the VM with Remote Desktop enabled.  I can add support via Management Portal manually after the event but would ideally wish to add the functionality when the VM is first spun up.  

This is the main chunk of code i'm using, which works for creating a VM from an image aside from not creating the Remote Desktop port. I did also try adding an InputEndpoint to the ConfigurationSet but that didn't seem to do anything and hence i'm now stuck. So any pointers would be gratefully received.

     var result = this.client.VirtualMachines.CreateDeploymentAsync("my-test-vm",
                new VirtualMachineCreateDeploymentParameters()
                {
                    Name = "my-test-vm",
                    Label = "deployment1",
                    DeploymentSlot = DeploymentSlot.Production,
                    Roles = new List<Role>()
                    {
                        new Role()
                        {
                            ConfigurationSets = new List<ConfigurationSet>()
                    {
                        new ConfigurationSet()
                        {
                            ConfigurationSetType="WindowsProvisioningConfiguration",
                            AdminUserName ="DummyAdmin",
                            AdminPassword="DummyPa55word" ,
                            ComputerName="my-test-vm-001",
                            EnableAutomaticUpdates=true
                        }                            ,
                            ProvisionGuestAgent=true,
                            RoleName="my-test-vm",
                            RoleType = "PersistentVMRole" ,
                            RoleSize=  "Small",
                            OSVirtualHardDisk=new OSVirtualHardDisk()
                            {
                                MediaLink=new Uri("https://dummy.blob.core.windows.net/vhds/" +"a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"),
                                SourceImageName = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
                            }
                        }
                    }
                }).Result;

Also am I better off using the REST API directly? I have noticed there is next to nothing in the way of deeper documentation/samples for the .NET API versus stuff for the REST API and I was initially writing my own equivalent wrapper anyway before realising the .NET API project existed.


Viewing all articles
Browse latest Browse all 12545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>