0

I wanted to automate the deployment of azure arc data controller and azure arc sql managed instance. I cannot see ARM templates to deploy and I have tried with azure cli using commands those commands are not working. Is there any way to automate the deployment using ARM templates or Terraform or Ansible or any?

Expected ARM templates and any other IAC tools supports deployment.

GokuLc
  • 1
  • check if this repository helps https://github.com/terraform-azurerm-examples/arc-onprem-servers – SoySolisCarlos Aug 24 '23 at 01:25
  • Checked, This repository does not contain any related information. – GokuLc Aug 28 '23 at 09:47
  • Can you check this [MSDoc](https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/automanage/arm-deploy-arc.md) once whether it works for you. @GokuLc – Jahnavi Aug 29 '23 at 08:03

1 Answers1

0

I tried to automate the deployment of the Azure Arc data controller with Azure Arc SQL-managed instance using Terraform I was able to provision the requirement successfully

Since we have through the different IAC tools like ARM templets, Ansible & Terraform

For deployment with ARM templates refer to the doc shared in comments. Here I used to deploy the infrastructure using the terraform As you mentioned any one of these three mentioned is valid here.

My terraform configuration:

data "azurerm_resource_group" "example" {
   name = "v-bolliv"
}

# Deploy Azure Arc Data Controller
resource "azurerm_kubernetes_cluster" "arc_data_controller" {
  name                = "arc-data-controller"
  location            = data.azurerm_resource_group.example.location
  resource_group_name = data.azurerm_resource_group.example.name
  dns_prefix          = "arc-data-controller"

  default_node_pool {
    name            = "default"
    node_count      = 1
    vm_size         = "Standard_D2_v2"
    os_disk_size_gb = 30
  }
  
   identity {
    type = "SystemAssigned"
  }


  addon_profile {
    kube_dashboard {
      enabled = true
    }
  }
}
resource "azurerm_virtual_network" "example" {
  name                = "vnet-mi"
  resource_group_name = data.azurerm_resource_group.example.name
  address_space       = ["10.0.0.0/16"]
  location            = data.azurerm_resource_group.example.location
}

resource "azurerm_subnet" "example" {
  name                 = "subnet-mi"
  resource_group_name  = data.azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.0.0/24"]

  delegation {
    name = "managedinstancedelegation"

    service_delegation {
      name    = "Microsoft.Sql/managedInstances"
      actions = ["Microsoft.Network/virtualNetworks/subnets/join/action", "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action"]
    }
  }
}


resource "azurerm_route_table" "example" {
  name                          = "routetable-mi"
  location                      = data.azurerm_resource_group.example.location
  resource_group_name           = data.azurerm_resource_group.example.name
  disable_bgp_route_propagation = false
  depends_on = [
    azurerm_subnet.example,
  ]
}

resource "azurerm_subnet_route_table_association" "example" {
  subnet_id      = azurerm_subnet.example.id
  route_table_id = azurerm_route_table.example.id
}

# Deploy Azure Arc SQL Managed Instance
resource "azurerm_sql_managed_instance" "arc_sql_managed_instance" {
  name                = "arc-sql-managed-instance"
  location            = data.azurerm_resource_group.example.location
  resource_group_name = data.azurerm_resource_group.example.name
  sku_name            = "GP_Gen5"
  storage_size_in_gb  = 32
  vcores              = 4
  administrator_login = "adminuser"
  administrator_login_password = "Intel@190994"
  subnet_id           = azurerm_subnet.example.id
  license_type        = "BasePrice"

  extended_auditing_policy {
    azure_arc_managed_instance_auditing_policy {
      is_enabled = true
    }
  }

   depends_on = [
    azurerm_subnet_route_table_association.example,
  ]
}

Output:

enter image description here

enter image description here

VinayKumarBolli
  • 457
  • 2
  • 6