如何使用 terraform 将 Azure Analysis Services Server (AASS) 与 Azure SQL 数据库和 Azure 数据工厂 (ADF) 连接

问题描述 投票:0回答:1

我计划使用 terraform 连接 azure 分析服务服务器与 Azure SQL 数据库和 Azure 数据工厂。

到目前为止,文档并没有那么有用,我想知道您是否可以提供一些有关如何实现此目的的示例 terraform 代码,或者您是否可以提供一些教程。

我想看看如何以安全的方式在所有这些之间建立网络连接。

resource "azurerm_analysis_services_server" "server" {
  name                    = "analysisservicesserver"
  location                = azurerm_resource_group.example.location
  resource_group_name     = azurerm_resource_group.example.name
  sku                     = "S0"
  admin_users             = ["[email protected]"]
  enable_power_bi_service = true

  ipv4_firewall_rule {
    name        = "myRule1"
    range_start = "210.117.252.0"
    range_end   = "210.117.252.255"
  }

  tags = {
    abc = 123
  }
}

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/analysis_services_server

此外

ipv4_firewall_rule 
我没有看到很多配置连接的选项(私有端点是一个要求,但还不清楚)

azure terraform azure-sql-database azure-data-factory azure-analysis-services
1个回答
0
投票

如何使用 terraform 将 Azure Analysis Services Server (AASS) 与 Azure SQL 数据库和 Azure 数据工厂 (ADF) 连接。

根据 MSDocgithub,Azure Analysis Services 目前似乎不支持专用终结点,并且几乎没有其他方法可以考虑其中之一,即虚拟网络服务终结点或虚拟网络规则。

Terraform 配置:

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "vksb-rg"
  location = "East US2"
}

resource "azurerm_virtual_network" "example" {
  name                = "vksb-vnet"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "example" {
  name                 = "vksb-subnet"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.1.0/24"]
  service_endpoints    = ["Microsoft.Sql", "Microsoft.Storage"]
}

resource "azurerm_mssql_server" "example" {
  name                         = "vksbsqlserver"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  version                      = "12.0"
  administrator_login          = "sqladmin"
  administrator_login_password = "H@Sh1CoR3!"
  minimum_tls_version          = "1.2"
}

resource "azurerm_mssql_database" "example" {
  name                = "vksbdb"
  server_id           = azurerm_mssql_server.example.id
  collation           = "SQL_Latin1_General_CP1_CI_AS"
  license_type        = "LicenseIncluded"
  max_size_gb         = 10  
  sku_name            = "S0"
  zone_redundant      = false
  read_scale          = false  
}

resource "azurerm_analysis_services_server" "example" {
  name                    = "vksbanalysisservicesserver"
  location                = azurerm_resource_group.example.location
  resource_group_name     = azurerm_resource_group.example.name
  sku                     = "S0"
  admin_users             = ["[email protected]"]
}

resource "azurerm_data_factory" "example" {
  name                = "vksbdf"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_network_security_group" "example" {
  name                = "vksb-nsg"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  security_rule {
    name                       = "AllowSQL"
    priority                   = 1001
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "1433"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }

  security_rule {
    name                       = "AllowAnalysisServices"
    priority                   = 1002
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "80"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
}

resource "azurerm_subnet_network_security_group_association" "example" {
  subnet_id                 = azurerm_subnet.example.id
  network_security_group_id = azurerm_network_security_group.example.id
}

部署:

enter image description here

enter image description here

enter image description here

参考:

https://learn.microsoft.com/en-us/azure/azure-sql/database/sql-database-paas-overview?view=azuresql

https://learn.microsoft.com/en-us/azure/data-factory/introduction

https://learn.microsoft.com/en-us/azure/analysis-services/analysis-services-vnet-gateway

© www.soinside.com 2019 - 2024. All rights reserved.