bicep code to create Hybrid cluster on Azure stack HCI

Saravanan Krishnan 40 Reputation points
2024-02-19T03:53:29.34+00:00

Hello, I've recently deployed a Hybrid AKS cluster (Arc-enabled) on Azure Stack HCI 23H2. Now, I aim to automate this process using Bicep code. I'm seeking either a sample code or reference documentation to assist me in this endeavor. Thanks Saravanan K

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
337 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,885 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anveshreddy Nimmala 2,705 Reputation points Microsoft Vendor
    2024-02-19T07:44:09.1866667+00:00

    Hello Saravanan Krishnan, Welcome to microsoft Q&A, thankyou for posting your query here. Please check below reference code to automate the cluster creation using bicep.

    param provisionedClustersName string
    param customLocation string ='/subscriptions/xxxxx/resourceGroups/SB-WE-RG-HCIResourceBridge/providers/Microsoft.ExtendedLocation/customLocations/SB-DCHPELAB-AKS'
    param adminGroupObjectIDs array = []
    @secure()
    param sshkey string
    param location string = 'westeurope'
    param resourceTags object = {
    }
    param controlPlaneNodeCount int
    param controlPlaneNodesize string = 'Standard_A4_v2'
    param controlPlaneOsType string = 'Linux'
    param kubernetesVersion string = 'v1.22.11'
    param loadBalancerNodeSize string = 'Standard_A4_v2'
    param loadBalancerNodeCount int
    param loadBalancerSku string = 'unstacked-haproxy'
    param loadBalancerOsType string = 'Linux'
    param podCidr string = '10.244.0.0/16'
    param networkPolicy string = 'calico'
    param vnetSubnetIds array = ['/subscriptions/xxxxx/resourceGroups/SB-WE-RG-HCIResourceBridge/providers/Microsoft.HybridContainerService/virtualNetworks/sb-dchpelab-aksvnet101']
    param agentpoolname string = '${provisionedClustersName}-nodepool1'
    param agentpoolCount int
    param agentpoolVMsize string = 'Standard_A4_v2'
    param agentpoolOsType string = 'Linux'
    resource provisionedClustersName_resource 'Microsoft.HybridContainerService/ProvisionedClusters@2022-05-01-preview' = {
      name: provisionedClustersName
      location: location
      extendedLocation: {
        type: 'customLocation'
        name: customLocation
      }
      tags: resourceTags
      identity: {
        type: 'SystemAssigned'
      }
      properties: {  
        aadProfile: {
        adminGroupObjectIDs: adminGroupObjectIDs
        }
        linuxProfile: {
          ssh: {
          publicKeys: [
           {
             keyData: sshkey
           }
         ]
       }
      }
      controlPlane: {
        count: controlPlaneNodeCount
        osType: controlPlaneOsType
        vmSize: controlPlaneNodesize
      }
      kubernetesVersion: kubernetesVersion
      networkProfile: {
        loadBalancerProfile: {
        count: loadBalancerNodeCount
          osType: loadBalancerOsType
          vmSize: loadBalancerNodeSize
        }
        loadBalancerSku: loadBalancerSku
        networkPolicy: networkPolicy
        podCidr: podCidr
      }
      agentPoolProfiles: [
        {
          name: agentpoolname
          count: agentpoolCount
          vmSize: agentpoolVMsize
          osType: agentpoolOsType
        }
      ]
      cloudProviderProfile: {
        infraNetworkProfile: {
          vnetSubnetIds: vnetSubnetIds
        }
       }
     }
    }
    

    Please find the below link to refer and understand the template. https://learn.microsoft.com/en-us/azure/templates/microsoft.azurestackhci/clusters?pivots=deployment-language-bicep Hope this is helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!