0

Let's say I have to deploy over 200 virtual machines on azure. Every single vm host a web site, and each of them must have unique domain/ip address.

I can deploy each vm to separate cloude service (and have different ip's), but limit of cloude services per subscription is 200, so in this way I am limited to 200 vm's (web sites).

But what if I deploy multiple vm's in one cloude service (limit is 50 vm's per cloud service). I this way I can have 50 vm's per cloude service * 200 cloud services per subscription!

Problem is that vm's must have different domains/ip's, and when I deploy multiple vm's to one cloude service, all vm's have same domain and ip.

  1. How to have different domain/ip for multiple virtual machines in single cloude service?

  2. Can this be achived with multiple vip's per cloud service? https://azure.microsoft.com/en-us/documentation/articles/load-balancer-multivip/

  3. Can this be achived with reserved ip addresses? https://azure.microsoft.com/en-us/blog/reserved-ip-addresses/

  4. Can this be achived with the new Resource Manager model?

Code that I curently use to deploy multiple vm's to single cloud service:

private async Task CreateVirtualMachine()
    {
        DeploymentGetResponse deploymentResponse = await _computeManagementClient.Deployments.GetBySlotAsync("myservicename", DeploymentSlot.Production);

        if (deploymentResponse == null)
        {
            var parameters = new VirtualMachineCreateDeploymentParameters
            {
                DeploymentSlot = DeploymentSlot.Production,
                Name = "mservicename",
                Label = "myservicename"
            };

            parameters.Roles.Add(new Role
            {
                OSVirtualHardDisk = new OSVirtualHardDisk
                {
                    HostCaching = VirtualHardDiskHostCaching.ReadWrite,
                    SourceImageName = "imagename"
                },

                RoleName = "vmname",
                RoleType = VirtualMachineRoleType.PersistentVMRole.ToString(),
                RoleSize = VirtualMachineRoleSize.Small,
                ProvisionGuestAgent = true
            });

            parameters.Roles[0].ConfigurationSets.Add(new ConfigurationSet
            {
                ComputerName = "vmname",
                ConfigurationSetType = ConfigurationSetTypes.LinuxProvisioningConfiguration,
                HostName = "vmname",
                AdminUserName = "adminusername",
                AdminPassword = "adminpass",
                UserName = "username",
                UserPassword = "userpass",
                DisableSshPasswordAuthentication = false,

            });

            parameters.Roles[0].ConfigurationSets.Add(new ConfigurationSet
            {
                ConfigurationSetType = ConfigurationSetTypes.NetworkConfiguration,
                InputEndpoints = new List<InputEndpoint>()
                {
                    new InputEndpoint()
                    {
                        Name = "HTTP",
                        Protocol = InputEndpointTransportProtocol.Tcp,
                        LocalPort =  80,
                        Port = 80
                    }
                }
            });

            var response = await _computeManagementClient.VirtualMachines.CreateDeploymentAsync("mservicename", parameters);

        }
        else
        {
            var createParameters = new VirtualMachineCreateParameters
            {
                OSVirtualHardDisk = new OSVirtualHardDisk
                {
                    HostCaching = VirtualHardDiskHostCaching.ReadWrite,
                    SourceImageName = "imagename"
                },

                RoleName = "vmname",
                RoleSize = VirtualMachineRoleSize.Small,
                ProvisionGuestAgent = true,

                ConfigurationSets = new List<ConfigurationSet>
            {
                new ConfigurationSet
                {

                    ComputerName = "vmname",
                    ConfigurationSetType = ConfigurationSetTypes.LinuxProvisioningConfiguration,
                    HostName = "vmname",
                    AdminUserName = "adminusername",
                    AdminPassword = "adminpass",
                    UserName = "username",
                    UserPassword = "userpass",
                    DisableSshPasswordAuthentication = false
                },
                new ConfigurationSet
                {
                    ConfigurationSetType = ConfigurationSetTypes.NetworkConfiguration,
                    InputEndpoints = new List<InputEndpoint>()
                    {
                        new InputEndpoint()
                        {
                            Name = "HTTP",
                            Protocol = InputEndpointTransportProtocol.Tcp,
                            LocalPort =  81,
                            Port = 81
                        }
                    }
                }
            }
            };

            var responseCreate = await _computeManagementClient.VirtualMachines.CreateAsync("mservicename", deploymentResponse.Name, createParameters);

        }
    }
1

If you want each VM to have it's own IP inside a cloud service then you need to look at Instance Level Public IP's, these are individual IP's assigned to each VM, not the cloud service.

However, I would suggest you also look at moving away from using cloud services altogether and look at using the new Resource Manager based stack instead. If you weren't aware all of Azure's V2 resources move away from the cloud service model and instead use the new resource manager format. This new format has some significant advantages for what you are doing:

  • Breaking our Network Interfaces and Load Balancers into separate items that can have separate public and private IP's
  • Declarative Template based creation of resources
  • Creation of resources in parallel, especially important if you are going to need to create lots of VM's at once

Cloud Service are still around, and there has been no announcement on their removal, but the ARM model would seem to fit much better with what you are trying to do.

| improve this answer | |
  • Do you have insider information for the last comment? My understanding of the plan is to have ASM and ARM live "side-by-side" and "seamless" into the future. – CtrlDot May 24 '16 at 19:43
  • No, no insider knowledge and as far as I am aware there have been no announcements from MS, however the focus is very much on ARM, some new services are being released only on ARM (Azure Batch, Cool Storage etc.) and it is a much more intuitive approach. All of that said, it is just speculation, I will tidy up the answer to remove it. – Sam Cogan May 24 '16 at 19:47
  • Thanks, I just heard something to the contrary (ASM will be staying around) and wanted to double check. Ultimately there is no ARM replacement for web/worker roles just yet, but I see SF and ASE taking that space. Will wait to see how it shapes up. Thanks for editing your answer. Cheers. – CtrlDot May 25 '16 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.