Azure CLI - プライベート リンクを使用してマネージド ディスクに対するインポートおよびエクスポート アクセスを制限するAzure CLI - Restrict import/export access for managed disks with Private Links
プライベート エンドポイントを使用すると、マネージド ディスクのエクスポートとインポートを制限し、Azure 仮想ネットワーク上のクライアントからプライベート リンクを介してデータに安全にアクセスできます。You can use private endpoints to restrict the export and import of managed disks and securely access data over a Private Link from clients on your Azure virtual network. プライベート エンドポイントでは、対象のマネージド ディスク サービスのために仮想ネットワークのアドレス空間の IP アドレスを使用します。The private endpoint uses an IP address from the virtual network address space for your managed disks service. 仮想ネットワーク上のクライアントとマネージド ディスク間のネットワーク トラフィックは、仮想ネットワークおよび Microsoft バックボーン ネットワーク上のプライベート リンク経由でのみ送信され、パブリック インターネットから公開されることはなくなります。Network traffic between clients on their virtual network and managed disks only traverses over the virtual network and a private link on the Microsoft backbone network, eliminating exposure from the public internet.
プライベート リンクを使用してマネージド ディスクをエクスポートまたはインポートするには、ディスク アクセス リソースを作成した後、プライベート エンドポイントを作成することによってこれを同じサブスクリプション内の仮想ネットワークにリンクします。To use Private Links to export/import managed disks, first you create a disk access resource and link it to a virtual network in the same subscription by creating a private endpoint. 次に、ディスクまたはスナップショットをディスク アクセスのインスタンスに関連付けます。Then, associate a disk or a snapshot with an instance of disk access. 最後に、ディスクまたはスナップショットの NetworkAccessPolicy プロパティを AllowPrivate
に設定します。Finally, set the NetworkAccessPolicy property of the disk or the snapshot to AllowPrivate
. これにより、対象の仮想ネットワークへのアクセスが制限されます。This will limit access to your virtual network.
NetworkAccessPolicy プロパティを DenyAll
に設定して、ディスクまたはスナップショットのデータをだれもエクスポートできないようにすることができます。You can set the NetworkAccessPolicy property to DenyAll
to prevent anybody from exporting data of a disk or a snapshot. NetworkAccessPolicy プロパティの既定値は AllowAll
です。The default value for the NetworkAccessPolicy property is AllowAll
.
制限事項Limitations
- これらをリンクするには、仮想ネットワークがディスク アクセス オブジェクトと同じサブスクリプションにある必要があります。Your virtual network must be in the same subscription as your disk access object to link them.
- 同じディスク アクセス オブジェクトを使用して、最大 10 個のディスクまたはスナップショットを同時にインポートまたはエクスポートできます。Up to 10 disks or snapshots can be imported or exported at the same time with the same disk access object.
- 仮想ネットワークをディスク アクセス オブジェクトにリンクするために手動承認を要求することはできません。You cannot request manual approval to link a virtual network to a disk access object.
サブスクリプションにログインし、変数を設定するLog in into your subscription and set your variables
subscriptionId=yourSubscriptionId
resourceGroupName=yourResourceGroupName
region=northcentralus
diskAccessName=yourDiskAccessForPrivateLinks
vnetName=yourVNETForPrivateLinks
subnetName=yourSubnetForPrivateLinks
privateEndPointName=yourPrivateLinkForSecureMDExportImport
privateEndPointConnectionName=yourPrivateLinkConnection
#The name of an existing disk which is the source of the snapshot
sourceDiskName=yourSourceDiskForSnapshot
#The name of the new snapshot which will be secured via Private Links
snapshotNameSecuredWithPL=yourSnapshotNameSecuredWithPL
az login
az account set --subscription $subscriptionId
Azure CLI を使用してディスク アクセスを作成するCreate a disk access using Azure CLI
az disk-access create -n $diskAccessName -g $resourceGroupName -l $region
diskAccessId=$(az disk-access show -n $diskAccessName -g $resourceGroupName --query [id] -o tsv)
仮想ネットワークを作成しますCreate a Virtual Network
ネットワーク セキュリティ グループ (NSG) などのネットワーク ポリシーは、プライベート エンドポイントではサポートされていません。Network policies like network security groups (NSG) are not supported for private endpoints. 特定のサブネットにプライベート エンドポイントをデプロイするには、そのサブネット上で明示的な無効化設定が必要です。In order to deploy a Private Endpoint on a given subnet, an explicit disable setting is required on that subnet.
az network vnet create --resource-group $resourceGroupName \
--name $vnetName \
--subnet-name $subnetName
サブネットのプライベート エンドポイント ポリシーを無効にするDisable subnet private endpoint policies
Azure では仮想ネットワーク内のサブネットにリソースがデプロイされるため、プライベート エンドポイントのネットワーク ポリシーを無効にするようにサブネットを更新する必要があります。Azure deploys resources to a subnet within a virtual network, so you need to update the subnet to disable private endpoint network policies.
az network vnet subnet update --resource-group $resourceGroupName \
--name $subnetName \
--vnet-name $vnetName \
--disable-private-endpoint-network-policies true
ディスク アクセス オブジェクトのプライベート エンドポイントを作成するCreate a private endpoint for the disk access object
az network private-endpoint create --resource-group $resourceGroupName \
--name $privateEndPointName \
--vnet-name $vnetName \
--subnet $subnetName \
--private-connection-resource-id $diskAccessId \
--group-ids disks \
--connection-name $privateEndPointConnectionName
プライベート DNS ゾーンを構成するConfigure the Private DNS Zone
ストレージ BLOB ドメイン用のプライベート DNS ゾーンを作成し、Virtual Network に対する関連付けリンクを作成します。また、プライベート エンドポイントをプライベート DNS ゾーンに関連付けるために、DNS ゾーン グループを作成します。Create a Private DNS Zone for Storage blob domain, create an association link with the Virtual Network and create a DNS Zone Group to associate the private endpoint with the Private DNS Zone.
az network private-dns zone create --resource-group $resourceGroupName \
--name "privatelink.blob.core.windows.net"
az network private-dns link vnet create --resource-group $resourceGroupName \
--zone-name "privatelink.blob.core.windows.net" \
--name yourDNSLink \
--virtual-network $vnetName \
--registration-enabled false
az network private-endpoint dns-zone-group create \
--resource-group $resourceGroupName \
--endpoint-name $privateEndPointName \
--name yourZoneGroup \
--private-dns-zone "privatelink.blob.core.windows.net" \
--zone-name disks
プライベート リンクを使用して保護されたディスクを作成するCreate a disk protected with Private Links
resourceGroupName=yourResourceGroupName
region=northcentralus
diskAccessName=yourDiskAccessName
diskName=yourDiskName
diskSkuName=Standard_LRS
diskSizeGB=128
diskAccessId=$(az resource show -n $diskAccessName -g $resourceGroupName --namespace Microsoft.Compute --resource-type diskAccesses --query [id] -o tsv)
az disk create -n $diskName \
-g $resourceGroupName \
-l $region \
--size-gb $diskSizeGB \
--sku $diskSkuName \
--network-access-policy AllowPrivate \
--disk-access $diskAccessId
プライベート リンクを使用して保護されたディスクのスナップショットを作成するCreate a snapshot of a disk protected with Private Links
resourceGroupName=yourResourceGroupName
region=northcentralus
diskAccessName=yourDiskAccessName
sourceDiskName=yourSourceDiskForSnapshot
snapshotNameSecuredWithPL=yourSnapshotName
diskId=$(az disk show -n $sourceDiskName -g $resourceGroupName --query [id] -o tsv)
diskAccessId=$(az resource show -n $diskAccessName -g $resourceGroupName --namespace Microsoft.Compute --resource-type diskAccesses --query [id] -o tsv)
az snapshot create -n $snapshotNameSecuredWithPL \
-g $resourceGroupName \
-l $region \
--source $diskId \
--network-access-policy AllowPrivate \
--disk-access $diskAccessId