> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Private Link

> Azure Private Link 설정 방법

export const ScalePlanFeatureBadge = ({feature = '이 기능', linking_verb_are = false}) => {
  return <div className="scalePlanFeatureContainer">
            <div className="scalePlanFeatureBadge">
                Scale 플랜 기능
            </div>
            <div>
                <p>{feature} Scale 및 Enterprise 플랜에서 제공됩니다. 업그레이드하려면 Cloud Console의 플랜 페이지를 방문하세요.</p>
            </div>
        </div>;
};

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

<ScalePlanFeatureBadge feature="Azure Private Link" />

이 가이드에서는 Azure Private Link를 사용하여 Azure(고객 소유 서비스 및 Microsoft Partner 서비스 포함)와 ClickHouse Cloud 간에 가상 네트워크를 통한 비공개 연결을 제공하는 방법을 설명합니다. Azure Private Link는 데이터가 퍼블릭 인터넷에 노출되지 않도록 하여 네트워크 아키텍처를 단순화하고 Azure 내 엔드포인트 간 연결을 안전하게 보호합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=dc77d27afd6dd25a67c8a73341fe7a6c" size="lg" alt="PrivateLink 개요" background="white" width="906" height="414" data-path="images/cloud/security/azure-pe.webp" />

<Warning>
  Azure Private Link는 Azure VNet에서 ClickHouse Cloud로 시작되는 연결만 지원합니다. 프라이빗 데이터베이스와 같이 ClickHouse Cloud에서 VNet 내 서비스로 시작되는 연결에는 사용할 수 없습니다.
</Warning>

Azure는 Private Link를 통한 리전 간 연결을 지원합니다. 이를 통해 ClickHouse 서비스가 배포된 서로 다른 리전에 있는 VNet 간 연결을 설정할 수 있습니다.

<Note>
  리전 간 트래픽에는 추가 요금이 부과될 수 있습니다. 최신 Azure 문서를 확인하십시오.
</Note>

**Azure Private Link를 활성화하려면 다음 단계를 수행하십시오.**

1. Private Link용 Azure connection alias를 가져옵니다
2. Azure에서 Private Endpoint를 생성합니다
3. Private Endpoint Resource ID를 ClickHouse Cloud 조직에 추가합니다
4. Private Endpoint Resource ID를 서비스 허용 목록에 추가합니다
5. Private Link를 사용하여 ClickHouse Cloud 서비스에 액세스합니다

<Note>
  ClickHouse Cloud Azure PrivateLink는 resourceGUID 대신 Resource ID 필터를 사용하도록 변경되었습니다. 이전 버전과의 호환성을 위해 resourceGUID를 계속 사용할 수 있지만, Resource ID 필터로 전환할 것을 권장합니다. 마이그레이션하려면 Resource ID를 사용하여 새 엔드포인트를 생성하고 이를 서비스에 연결한 후, 기존 resourceGUID 기반 엔드포인트를 제거하면 됩니다.
</Note>

<div id="attention">
  ## 주의
</div>

ClickHouse는 Azure 리전 내에서 동일한 게시된 [Private Link service](https://learn.microsoft.com/en-us/azure/private-link/private-link-service-overview)를 재사용할 수 있도록 서비스를 그룹화하려고 합니다. 하지만 이러한 그룹화는 보장되지 않으며, 특히 서비스가 여러 ClickHouse 조직에 분산되어 있는 경우에는 더욱 그렇습니다.
ClickHouse 조직의 다른 서비스에 대해 이미 Private Link가 구성되어 있다면, 이러한 그룹화 덕분에 대부분의 단계를 건너뛰고 마지막 단계인 [서비스 허용 목록에 Private Endpoint Resource ID 추가](#add-private-endpoint-id-to-services-allow-list)로 바로 진행할 수 있는 경우가 많습니다.

Terraform 예시는 ClickHouse [Terraform 프로바이더 리포지토리](https://github.com/ClickHouse/terraform-provider-clickhouse/tree/main/examples/)에서 확인할 수 있습니다.

<div id="obtain-azure-connection-alias-for-private-link">
  ## Private Link용 Azure connection alias 가져오기
</div>

<div id="option-1-clickhouse-cloud-console">
  ### 옵션 1: ClickHouse Cloud 콘솔
</div>

ClickHouse Cloud 콘솔에서 PrivateLink로 연결하려는 서비스를 연 다음 **설정** 메뉴를 엽니다. **Set up private endpoint** 버튼을 클릭하십시오. Private Link를 설정할 때 사용할 `Service name`과 `DNS name`을 메모해 두십시오.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-privatelink-pe-create.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=731b46648c85879bd271b3c9fa4a8f44" size="lg" alt="Private Endpoints" border width="1898" height="918" data-path="images/cloud/security/azure-privatelink-pe-create.webp" />

`Service name`과 `DNS name`을 메모해 두십시오. 다음 단계에서 필요합니다.

<div id="option-2-api">
  ### 옵션 2: API
</div>

시작하기 전에 ClickHouse Cloud API Key가 필요합니다. [새 키를 생성](/docs/ko/products/cloud/features/admin-features/api/openapi)하거나 기존 키를 사용할 수 있습니다.

API Key를 준비했다면, 명령을 실행하기 전에 다음 환경 변수를 설정하세요.

```bash theme={null}
REGION=<region code, use Azure format, for example: westus3>
PROVIDER=azure
KEY_ID=<Key ID>
KEY_SECRET=<Key secret>
ORG_ID=<set ClickHouse organization ID>
SERVICE_NAME=<Your ClickHouse service name>
```

리전, provider 및 서비스 이름으로 필터링하여 ClickHouse `INSTANCE_ID`를 확인하십시오:

```shell theme={null}
INSTANCE_ID=$(curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \
"https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services" | \
jq ".result[] | select (.region==\"${REGION:?}\" and .provider==\"${PROVIDER:?}\" and .name==\"${SERVICE_NAME:?}\") | .id " -r)
```

Private Link에 사용할 Azure connection alias와 Private DNS 호스트명을 확인합니다:

```bash theme={null}
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq  .result
{
  "endpointServiceId": "production-westus3-0-0.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.westus3.azure.privatelinkservice",
  "privateDnsHostname": "xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud"
}
```

`endpointServiceId`를 메모해 두세요. 다음 단계에서 사용합니다.

<div id="create-private-endpoint-in-azure">
  ## Azure에서 Private Endpoint 생성
</div>

<Warning>
  이 섹션에서는 Azure Private Link를 통해 ClickHouse를 구성할 때 필요한 ClickHouse 관련 세부 정보를 설명합니다. Azure 관련 단계는 어디를 확인해야 하는지 안내하기 위한 참고용으로 제공되며, Azure 클라우드 제공업체의 사전 고지 없이 변경될 수 있습니다. 사용 사례에 맞게 Azure 구성을 검토하십시오.

  필수 Azure Private Endpoint 및 DNS 레코드 구성은 ClickHouse의 책임 범위에 포함되지 않습니다.

  Azure 구성 작업과 관련된 문제가 있으면 Azure Support에 직접 문의하십시오.
</Warning>

이 섹션에서는 Azure에서 Private Endpoint를 생성합니다. Azure Portal 또는 Terraform을 사용할 수 있습니다.

<div id="option-1-using-azure-portal-to-create-a-private-endpoint-in-azure">
  ### 옵션 1: Azure Portal을 사용하여 Azure에서 Private Endpoint 만들기
</div>

Azure Portal에서 **Private Link Center → Private Endpoints**를 엽니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-private-link-center.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=d9c347f124b516d3948912a75f2ccd68" size="lg" alt="Azure Private Center 열기" border width="1485" height="693" data-path="images/cloud/security/azure-private-link-center.webp" />

**Create** 버튼을 클릭하여 Private Endpoint 생성 대화 상자를 엽니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-private-link-center.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=d9c347f124b516d3948912a75f2ccd68" size="lg" alt="Azure Private Center 열기" border width="1485" height="693" data-path="images/cloud/security/azure-private-link-center.webp" />

***

다음 화면에서 아래 옵션을 지정합니다.

* **Subscription** / **리소스 그룹**: Private Endpoint에 사용할 Azure subscription과 리소스 그룹을 선택하십시오.
* **Name**: **Private Endpoint**의 이름을 설정합니다.
* **Region**: Private Link를 통해 ClickHouse Cloud에 연결할 VNet이 배포된 리전을 선택합니다.

위 단계를 완료한 후 **Next: Resource** 버튼을 클릭합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-create-basic.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=24f19464e799ac2bde676abfb623c770" size="md" alt="Private Endpoint 기본 생성" border width="784" height="923" data-path="images/cloud/security/azure-pe-create-basic.webp" />

***

**Connect to an Azure resource by resource ID or alias** 옵션을 선택합니다.

**Resource ID or alias**에는 [Private Link용 Azure connection alias 가져오기](#obtain-azure-connection-alias-for-private-link) 단계에서 얻은 `endpointServiceId`를 사용합니다.

**Next: Virtual Network** 버튼을 클릭합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-resource.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=5df4afb2267c72c4ef7d7ad009190be6" size="md" alt="Private Endpoint 리소스 선택" border width="1122" height="911" data-path="images/cloud/security/azure-pe-resource.webp" />

***

* **Virtual network**: Private Link를 사용하여 ClickHouse Cloud에 연결할 VNet을 선택합니다
* **Subnet**: Private Endpoint를 생성할 subnet을 선택합니다

선택 사항:

* **Application security group**: ASG를 Private Endpoint에 연결한 다음, Network Security Groups에서 이를 사용하여 Private Endpoint로 들어오거나 나가는 네트워크 트래픽을 필터링할 수 있습니다.

**Next: DNS** 버튼을 클릭합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-create-vnet.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=0499d536c732468d4fa538221af4edfd" size="md" alt="Private Endpoint 가상 네트워크 선택" border width="1056" height="917" data-path="images/cloud/security/azure-pe-create-vnet.webp" />

**Next: Tags** 버튼을 클릭합니다.

***

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-create-dns.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=68da549d1d866baae8e2fbe58784e8df" size="md" alt="Private Endpoint DNS 구성" border width="818" height="921" data-path="images/cloud/security/azure-pe-create-dns.webp" />

필요한 경우 Private Endpoint에 tags를 추가할 수 있습니다.

**Next: Review + create** 버튼을 클릭합니다.

***

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-create-tags.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=b643c83fde1656d9ceb909489a4ca221" size="md" alt="Private Endpoint 태그" border width="912" height="919" data-path="images/cloud/security/azure-pe-create-tags.webp" />

마지막으로 **Create** 버튼을 클릭합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-create-review.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=a622720b6a4c59e7076c45289fb12bbd" size="md" alt="Private Endpoint 검토" border width="911" height="919" data-path="images/cloud/security/azure-pe-create-review.webp" />

생성된 Private Endpoint의 **Connection status**는 처음에 **Pending** 상태입니다. 이 Private Endpoint를 서비스 허용 목록에 추가하면 **Approved** 상태로 변경됩니다.

Private Endpoint와 연결된 네트워크 인터페이스를 열고 **Private IPv4 address**(이 예시에서는 10.0.0.4)를 복사하십시오. 이 정보는 다음 단계에서 필요합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-ip.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=9c0fccdb2a70bfc48e1f89e15ffb1a5b" size="lg" alt="Private Endpoint IP 주소" border width="1155" height="621" data-path="images/cloud/security/azure-pe-ip.webp" />

<div id="option-2-using-terraform-to-create-a-private-endpoint-in-azure">
  ### 옵션 2: Terraform을 사용해 Azure에서 Private Endpoint 생성하기
</div>

아래 템플릿을 사용하여 Terraform으로 Private Endpoint를 생성하십시오:

```json theme={null}
resource "azurerm_private_endpoint" "example_clickhouse_cloud" {
  name                = var.pe_name
  location            = var.pe_location
  resource_group_name = var.pe_resource_group_name
  subnet_id           = var.pe_subnet_id

  private_service_connection {
    name                              = "test-pl"
    private_connection_resource_alias = "<data from 'Obtain Azure connection alias for Private Link' step>"
    is_manual_connection              = true
  }
}
```

<div id="obtaining-private-endpoint-resourceid">
  ### Private Endpoint Resource ID 가져오기
</div>

Private Link를 사용하려면 서비스 허용 목록에 Private Endpoint 연결 Resource ID를 추가해야 합니다.

Private Endpoint Resource ID는 Azure Portal에 표시됩니다. 이전 단계에서 생성한 Private Endpoint를 열고 **JSON View**를 클릭하십시오.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-view.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=c1842eaec4c17cdfa0a4b5af45c746ef" size="lg" alt="Private Endpoint 보기" border width="1329" height="839" data-path="images/cloud/security/azure-pe-view.webp" />

properties 아래에서 `id` 필드를 찾아 이 값을 복사하십시오.

**권장 메서드: Resource ID 사용**

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-resource-id.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=9105d9076d60599e23ee2c9dbb72c1ff" size="lg" alt="Private Endpoint Resource ID" border width="1704" height="1824" data-path="images/cloud/security/azure-pe-resource-id.webp" />

**레거시 메서드: resourceGUID 사용**
하위 호환성을 위해 resourceGUID도 계속 사용할 수 있습니다. `resourceGuid` 필드를 찾아 이 값을 복사하십시오.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-resource-guid.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=35e544bfa40019510161104a43ab52f2" size="lg" alt="Private Endpoint Resource GUID" border width="1702" height="1830" data-path="images/cloud/security/azure-pe-resource-guid.webp" />

<div id="setting-up-dns-for-private-link">
  ## Private Link용 DNS 설정
</div>

Private Link를 통해 리소스에 액세스하려면 Private DNS 존(`${location_code}.privatelink.azure.clickhouse.cloud`)을 생성한 후 VNet에 연결해야 합니다.

<div id="create-private-dns-zone">
  ### Private DNS 존 생성
</div>

**옵션 1: Azure Portal 사용**

[Azure Portal을 사용해 Azure Private DNS 존을 생성하는 방법](https://learn.microsoft.com/en-us/azure/dns/private-dns-getstarted-portal)은 이 가이드를 참고하십시오.

**옵션 2: Terraform 사용**

다음 Terraform 템플릿을 사용해 Private DNS 존을 생성하십시오:

```json theme={null}
resource "azurerm_private_dns_zone" "clickhouse_cloud_private_link_zone" {
  name                = "${var.location}.privatelink.azure.clickhouse.cloud"
  resource_group_name = var.resource_group_name
}
```

<div id="create-a-wildcard-dns-record">
  ### 와일드카드 DNS 레코드 만들기
</div>

와일드카드 레코드를 생성하고 Private Endpoint를 가리키도록 설정합니다.

**옵션 1: Azure Portal 사용**

1. `MyAzureResourceGroup` 리소스 그룹을 열고 `${region_code}.privatelink.azure.clickhouse.cloud` Private DNS 영역을 선택합니다.
2. * Record set을 선택합니다.
3. Name에 `*`를 입력합니다.
4. IP Address에 Private Endpoint에 표시된 IP 주소를 입력합니다.
5. **OK**를 선택합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pl-dns-wildcard.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=11288ed1cf32f85fbc26bb8d6a11e9d4" size="lg" alt="Private Link DNS 와일드카드 설정" border width="1804" height="138" data-path="images/cloud/security/azure-pl-dns-wildcard.webp" />

**옵션 2: Terraform 사용**

다음 Terraform 템플릿을 사용하여 와일드카드 DNS 레코드를 생성합니다:

```json theme={null}
resource "azurerm_private_dns_a_record" "example" {
  name                = "*"
  zone_name           = var.zone_name
  resource_group_name = var.resource_group_name
  ttl                 = 300
  records             = ["10.0.0.4"]
}
```

<div id="create-a-virtual-network-link">
  ### 가상 네트워크 링크 생성
</div>

Private DNS 존을 가상 네트워크에 연결하려면 가상 네트워크 링크를 생성해야 합니다.

**옵션 1: Azure Portal 사용**

다음 가이드를 따라 [가상 네트워크를 Private DNS 존에 연결하십시오](https://learn.microsoft.com/en-us/azure/dns/private-dns-getstarted-portal#link-the-virtual-network).

**옵션 2: Terraform 사용**

<Note>
  DNS를 구성하는 방법은 다양합니다. 사용 사례에 맞게 DNS를 설정하십시오.
</Note>

[Private Link용 Azure connection alias 가져오기](#obtain-azure-connection-alias-for-private-link) 단계에서 확인한 "DNS name"이 Private Endpoint IP 주소를 가리키도록 설정해야 합니다. 이렇게 하면 VPC/Network 내의 서비스/구성 요소가 해당 이름을 올바르게 해석할 수 있습니다.

<div id="verify-dns-setup">
  ### DNS 설정 확인
</div>

`xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud` 도메인은 Private Endpoint의 IP를 가리켜야 합니다. (이 예시에서는 10.0.0.4입니다).

```bash theme={null}
nslookup xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud.
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud
Address: 10.0.0.4
```

<div id="add-the-private-endpoint-id-to-your-clickhouse-cloud-organization">
  ## ClickHouse Cloud 조직에 Private Endpoint Resource ID를 추가합니다
</div>

<div id="option-1-clickhouse-cloud-console">
  ### 옵션 1: ClickHouse Cloud 콘솔
</div>

조직에 엔드포인트를 추가하려면 [서비스 허용 목록에 Private Endpoint Resource ID 추가](#add-private-endpoint-id-to-services-allow-list) 단계로 이동하십시오. ClickHouse Cloud 콘솔에서 Private Endpoint Resource ID를 서비스 허용 목록에 추가하면 조직에도 자동으로 추가됩니다.

엔드포인트를 제거하려면 **Organization details -> Private Endpoints**를 열고 삭제 버튼을 클릭하십시오.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-pe-remove-private-endpoint.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=3f978e218a917c70b4db6d90a263fbbe" size="lg" alt="Private Endpoint 제거" border width="1478" height="807" data-path="images/cloud/security/azure-pe-remove-private-endpoint.webp" />

<div id="option-2-api">
  ### 옵션 2: API
</div>

명령을 실행하기 전에 다음 환경 변수를 설정하세요:

```bash theme={null}
PROVIDER=azure
KEY_ID=<Key ID>
KEY_SECRET=<Key secret>
ORG_ID=<set ClickHouse organization ID>
ENDPOINT_ID=<Private Endpoint Resource ID>
REGION=<region code, use Azure format>
```

[Private Endpoint Resource ID 가져오기](#obtaining-private-endpoint-resourceid) 단계에서 확인한 정보를 사용해 `ENDPOINT_ID` 환경 변수를 설정합니다.

다음 명령을 실행하여 Private Endpoint를 추가합니다:

```bash theme={null}
cat <<EOF | tee pl_config_org.json
{
  "privateEndpoints": {
    "add": [
      {
        "cloudProvider": "azure",
        "id": "${ENDPOINT_ID:?}",
        "description": "Azure private endpoint",
        "region": "${REGION:?}"
      }
    ]
  }
}
EOF
```

다음 명령을 실행하여 Private Endpoint를 삭제할 수도 있습니다:

```bash theme={null}
cat <<EOF | tee pl_config_org.json
{
  "privateEndpoints": {
    "remove": [
      {
        "cloudProvider": "azure",
        "id": "${ENDPOINT_ID:?}",
        "region": "${REGION:?}"
      }
    ]
  }
}
EOF
```

Private Endpoint를 추가하거나 제거한 후, 다음 명령을 실행하여 조직에 적용하십시오:

```bash theme={null}
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}" -d @pl_config_org.json
```

<div id="add-private-endpoint-id-to-services-allow-list">
  ## 서비스의 허용 목록에 Private Endpoint Resource ID 추가
</div>

기본적으로 ClickHouse Cloud 서비스는 Private Link 연결이 승인되고 설정된 경우에도 Private Link를 통해 사용할 수 없습니다. Private Link를 통해 사용할 각 서비스의 Private Endpoint Resource ID를 명시적으로 허용 목록에 추가해야 합니다.

<div id="option-1-clickhouse-cloud-console">
  ### 옵션 1: ClickHouse Cloud 콘솔
</div>

ClickHouse Cloud 콘솔에서 PrivateLink를 통해 연결할 서비스를 연 다음 **설정**으로 이동합니다. [이전](#obtaining-private-endpoint-resourceid) 단계에서 얻은 `Resource ID`를 입력합니다.

<Note>
  기존 PrivateLink connection의 액세스를 허용하려면 기존 endpoint 드롭다운 메뉴를 사용하십시오.
</Note>

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-privatelink-pe-filter.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=b1b219fc307883f226a591d3d20e11b4" size="lg" alt="Private Endpoints 필터" border width="1898" height="918" data-path="images/cloud/security/azure-privatelink-pe-filter.webp" />

<div id="option-2-api">
  ### 옵션 2: API
</div>

명령을 실행하기 전에 다음 환경 변수를 설정하세요:

```bash theme={null}
PROVIDER=azure
KEY_ID=<Key ID>
KEY_SECRET=<Key secret>
ORG_ID=<set ClickHouse organization ID>
ENDPOINT_ID=<Private Endpoint Resource ID>
INSTANCE_ID=<Instance ID>
```

Private Link를 통해 사용할 수 있어야 하는 각 서비스에 대해 이 작업을 실행하십시오.

다음 명령을 실행하여 서비스의 허용 목록에 Private Endpoint를 추가하십시오:

```bash theme={null}
cat <<EOF | tee pl_config.json
{
  "privateEndpointIds": {
    "add": [
      "${ENDPOINT_ID:?}"
    ]
  }
}
EOF
```

다음 명령을 실행하여 서비스 허용 목록에서 Private Endpoint를 제거할 수도 있습니다:

```bash theme={null}
cat <<EOF | tee pl_config.json
{
  "privateEndpointIds": {
    "remove": [
      "${ENDPOINT_ID:?}"
    ]
  }
}
EOF
```

Private Endpoint를 서비스 허용 목록에 추가하거나 제거한 후, 이를 조직에 적용하려면 다음 명령을 실행하세요:

```bash theme={null}
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" -d @pl_config.json | jq
```

<div id="access-your-clickhouse-cloud-service-using-private-link">
  ## Private Link를 사용하여 ClickHouse Cloud 서비스에 액세스하기
</div>

Private Link가 활성화된 각 서비스에는 퍼블릭 엔드포인트와 Private Endpoint가 있습니다. Private Link를 사용해 연결하려면 [Private Link용 Azure connection alias 가져오기](#obtain-azure-connection-alias-for-private-link)에서 확인한 `privateDnsHostname`<sup>API</sup> 또는 `DNS name`<sup>console</sup>에 해당하는 Private Endpoint를 사용해야 합니다.

<div id="obtaining-the-private-dns-hostname">
  ### Private DNS 호스트명 확인하기
</div>

<div id="option-1-clickhouse-cloud-console-3">
  #### 옵션 1: ClickHouse Cloud 콘솔
</div>

ClickHouse Cloud 콘솔에서 **설정**으로 이동합니다. **Set up private endpoint** 버튼을 클릭합니다. 열리는 플라이아웃에서 **DNS Name**을 복사합니다.

<Image img="https://mintcdn.com/private-7c7dfe99/Ph2XgLY43sq6v4yO/images/cloud/security/azure-privatelink-pe-dns.webp?fit=max&auto=format&n=Ph2XgLY43sq6v4yO&q=85&s=1b058b2bbb6dc5a9cc68ec8511492f22" size="lg" alt="Private Endpoint DNS Name" border width="1898" height="918" data-path="images/cloud/security/azure-privatelink-pe-dns.webp" />

<div id="option-2-api-3">
  #### 옵션 2: API
</div>

명령을 실행하기 전에 다음 환경 변수를 설정하세요:

```bash theme={null}
KEY_ID=<Key ID>
KEY_SECRET=<Key secret>
ORG_ID=<set ClickHouse organization ID>
INSTANCE_ID=<Instance ID>
```

다음 명령을 실행하세요:

```bash theme={null}
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq  .result
```

다음과 비슷한 응답이 반환됩니다:

```response theme={null}
{
  ...
  "privateDnsHostname": "xxxxxxx.<region code>.privatelink.azure.clickhouse.cloud"
}
```

이 예시에서는 `xxxxxxx.region_code.privatelink.azure.clickhouse.cloud` 호스트명으로의 연결이 Private Link로 라우팅됩니다. 반면 `xxxxxxx.region_code.azure.clickhouse.cloud`는 인터넷을 통해 라우팅됩니다.

`privateDnsHostname`을 사용하여 Private Link를 통해 ClickHouse Cloud 서비스에 연결하세요.

<div id="troubleshooting">
  ## 문제 해결
</div>

<div id="verify-dns-setup">
  ### DNS 설정 확인
</div>

다음 명령을 실행하세요:

```bash theme={null}
nslookup <dns name>
```

여기서 "dns name"은 [Private Link용 Azure connection alias 가져오기](#obtain-azure-connection-alias-for-private-link)에 있는 `privateDnsHostname`<sup>API</sup> 또는 `DNS name`<sup>console</sup>입니다.

다음과 같은 응답이 반환되어야 합니다:

```response theme={null}
Non-authoritative answer:
Name: <dns name>
Address: 10.0.0.4
```

<div id="connection-reset-by-peer">
  ### 상대편에서 연결을 재설정함
</div>

대개 서비스의 허용 목록에 Private Endpoint Resource ID가 추가되지 않았기 때문입니다. [*서비스 허용 목록에 Private Endpoint Resource ID 추가* 단계](#add-private-endpoint-id-to-services-allow-list)를 다시 확인하십시오.

<div id="private-endpoint-is-in-pending-state">
  ### Private Endpoint가 대기 상태입니다
</div>

대개 서비스 허용 목록에 Private Endpoint Resource ID가 추가되지 않았기 때문입니다. [*서비스 허용 목록에 Private Endpoint Resource ID 추가* 단계](#add-private-endpoint-id-to-services-allow-list)를 다시 확인하십시오.

<div id="test-connectivity">
  ### 연결 테스트
</div>

Private Link를 사용한 연결에 문제가 있으면 `openssl`로 연결 상태를 확인하십시오. Private Link endpoint status가 `Accepted` 상태인지 확인하십시오.

OpenSSL로 연결할 수 있어야 합니다(출력에 CONNECTED가 표시됨). `errno=104`는 정상적으로 예상되는 값입니다.

```bash theme={null}
openssl s_client -connect abcd.westus3.privatelink.azure.clickhouse.cloud:9440
```

```response highlight={1} theme={null}
CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 335 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
```

<div id="checking-private-endpoint-filters">
  ### Private Endpoint 필터 확인
</div>

명령을 실행하기 전에 다음 환경 변수를 설정하십시오:

```bash theme={null}
KEY_ID=<Key ID>
KEY_SECRET=<Key secret>
ORG_ID=<ClickHouse 조직 ID를 설정하세요>
INSTANCE_ID=<Instance ID>
```

다음 명령을 실행하여 Private Endpoint 필터를 확인하세요:

```bash theme={null}
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X GET -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" | jq .result.privateEndpointIds
```

<div id="more-information">
  ## 추가 정보
</div>

Azure Private Link에 관한 자세한 내용은 [azure.microsoft.com/en-us/products/private-link](https://azure.microsoft.com/en-us/products/private-link)를 참조하십시오.
