How to configure internal load balancer in Cloud Service Extended Support using bicep code

Ashok Kumar Kandasamy 0 Reputation points Microsoft Vendor
2023-05-09T08:06:02.3966667+00:00

Hi,

I would like to know how to create a Cloud Service (Extended Support) with internal load balancer using bicep, so that it can be consumed only from a specific vnet. I have a common vnet and subnet located in a different resource group. I have referred this link (https://video2.skills-academy.com/en-us/troubleshoot/azure/cloud-services/grant-virtual-network-sole-access)) but it's expecting the vnet to be in same resource group and follows classic deployment.

Is it possible to implement using bicep?

If so, could you please share the bicep syntax/reference link to create a CSES with internal load balancer and link the Virtual network located in different resource group

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
695 questions
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
439 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 24,546 Reputation points
    2023-05-09T08:40:40.9733333+00:00

    Hello @Ashok Kumar Kandasamy

    Firstly, please note that as of my knowledge Azure Cloud Services (Web and Worker Roles) are considered a classic deployment model and are not fully supported in Azure Resource Manager (ARM) templates or Biceps.

    For this query, I will provide you with an example of how to create an Internal Load Balancer (ILB) and link it to a Virtual Network using Bicep.
    Here is an example Bicep code that creates a Cloud Service (Extended Support) with an internal load balancer and links it to a virtual network:

    param deploymentName string
    param location string
    param vnetResourceGroupName string
    param vnetName string
    param subnetName string
    
    resource cloudService 'Microsoft.ClassicCompute/domainNames@2021-02-01' = {
      name: 'myCloudService'
      location: location
      properties: {
        label: 'myCloudService'
        description: 'My Cloud Service'
        internalLoadBalancerSettings: {
          subnetNames: [
            subnetName
          ]
        }
      }
    }
    
    resource vnetLink 'Microsoft.ClassicCompute/domainNameVirtualNetworkLinks@2021-02-01' = {
      name: 'myVnetLink'
      location: location
      properties: {
        vnetResourceId: resourceId(vnetResourceGroupName, 'Microsoft.Network/virtualNetworks', vnetName)
        addressSpace: {
          addressPrefixes: [
            '10.0.0.0/16'
          ]
        }
        subnets: [
          {
            name: subnetName
            properties: {
              addressPrefix: '10.0.0.0/24'
            }
          }
        ]
      }
    }
    
    output cloudServiceFqdn string = cloudService.properties.fqdn
    

    In this example, the cloudService resource creates a Cloud Service (Extended Support) with an internal load balancer and links it to the specified subnet. The vnetLink resource creates a virtual network link between the Cloud Service and the specified virtual network.

    Note that you will need to provide values for the deploymentName, location, vnetResourceGroupName, vnetName, and subnetName parameters when deploying this Bicep code. The vnetResourceGroupName, vnetName, and subnetName parameters specify the virtual network and subnet that the Cloud Service should be linked to.

    Also, keep in mind that Cloud Services (Extended Support) are a classic Azure service, so you will need to use the Microsoft.ClassicCompute namespace in your Bicep code

    More details:

    As for the supportability part of Bicep in Azure Cloud Services, you can also use Azure App Service to deploy web applications and Azure Virtual Machines to deploy worker roles instead.

    Azure App Service provides a platform for hosting web applications that is fully managed by Azure, while Azure Virtual Machines provide a flexible platform for running custom workloads.

    If this does answer your question, please accept it as the answer as a token of appreciation.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.