您可以在 SAN 等級啟用對彈性 SAN 端點的公共網際網路存取。 啟用彈性 SAN 的公用網路存取可讓您透過儲存體服務端點設定個別磁碟區群組的公用存取。 依據預設,即使您允許在 SAN 等級存取個別磁碟區群組,還是會拒絕公用存取。 您必須明確設定磁碟區群組,以允許從特定 IP 位址範圍和虛擬網路子網路存取。
您可以在建立彈性 SAN 時啟用公用網路存取,或使用 Azure PowerShell 模組或 Azure CLI 為現有的 SAN 啟用它。
# Set the variable values.
# The name of the resource group where the Elastic San is deployed.
$RgName = "<ResourceGroupName>"
# The name of the Elastic SAN.
$EsanName = "<ElasticSanName>"
# The region where the new Elastic San will be created.
$Location = "<Location>"
# The SKU of the new Elastic SAN - `Premium_LRS` or `Premium_ZRS`.
$SkuName = "<SkuName>"
# The base size of the new Elastic SAN.
$BaseSize = "<BaseSize>"
# The extended size of the new Elastic SAN.
$ExtendedSize = "<ExtendedSize>"
# Setup the parameters to create an Elastic San with public network access enabled.
$NewEsanArguments = @{
Name = $EsanName
ResourceGroupName = $RgName
BaseSizeTiB = $BaseSize
ExtendedCapacitySizeTiB = $ExtendedSize
Location = $Location
SkuName = $SkuName
PublicNetworkAccess = "Enabled"
}
# Create the Elastic San.
New-AzElasticSan @NewEsanArguments
# Set the variable values.
# The name of the resource group where the Elastic San is deployed.
$RgName="<ResourceGroupName>"
# The name of the Elastic SAN.
$EsanName="<ElasticSanName>"
# The region where the new Elastic San will be created.
$Location="<Location>"
# The SKU of the new Elastic SAN - `Premium_LRS` or `Premium_ZRS`.
$SkuName="<SkuName>"
# The base size of the new Elastic SAN.
$BaseSize="<BaseSize>"
# The extended size of the new Elastic SAN.
$ExtendedSize="<ExtendedSize>"
# Create the Elastic San.
az elastic-san create \
--elastic-san-name $EsanName \
--resource-group $RgName \
--location $Location \
--base-size-tib $BaseSize \
--extended-capacity-size-tib $ExtendedSize \
--sku $SkuName \
--public-network-access enabled
# Set the variable values.
$RgName="<ResourceGroupName>"
$EsanName="<ElasticSanName>"
# Update the Elastic San.
az elastic-san update \
--elastic-san-name $EsanName \
--resource-group $RgName \
--public-network-access enabled
設定 iSCSI 錯誤偵測
啟用 iSCSI 錯誤偵測
若要啟用 iSCSI 標頭或數據承載的 CRC-32C 總和檢查碼驗證,請在標頭或數據摘要上設定 CRC-32C,以取得連線至彈性 SAN 磁碟區之用戶端上所有連線的 CRC-32C。 若要這樣做,請使用 Azure 入口網站 或 Windows 或 Linux Elastic SAN 連線文章中產生的多會話腳本,將用戶端連線到彈性 SAN 磁碟區。
如果您需要,您可以執行這項操作,而不需要多會話連線腳本。 在 Windows 上,您可以在登入彈性 SAN 磁碟區期間,將標頭或數據摘要設定為 1,以PersistentLoginTarget執行這項操作。LoginTarget 在 Linux 上,您可以藉由更新全域 iSCSI 組態檔 (iscsid.conf,通常位於 /etc/iscsi 目錄中)。 當磁碟區連線時,節點會與該節點特定的組態檔一起建立(例如,在 Ubuntu 上,您可以在 /etc/iscsi/nodes/$volume_iqn/portal_hostname,$port 目錄)中找到,從全域組態檔繼承設定。 如果您在更新全域組態檔之前已將磁碟區連線到用戶端,請直接更新每個磁碟區的節點特定組態檔,或使用下列命令:
若要強制執行 iSCSI 錯誤偵測,請針對用戶端上的標頭和數據摘要設定 CRC-32C,並在包含已連線或尚未從用戶端連線的磁碟區群組上啟用 CRC 保護屬性。 如果您的彈性 SAN 磁碟區已連線,且兩個摘要都沒有 CRC-32C,您應該使用連線到彈性 SAN 磁碟區或 Windows 或 Linux 彈性 SAN 連線文章時,使用 Azure 入口網站 產生的多會話腳本來中斷磁碟區連線,並重新連線磁碟區。
# Set the variable values.
# The name of the resource group where the Elastic San is deployed.
$RgName = "<ResourceGroupName>"
# The name of the Elastic SAN.
$EsanName = "<ElasticSanName>"
# The name of volume group within the Elastic SAN.
$EsanVgName = "<VolumeGroupName>"
# Create a volume group by enabling CRC protection
New-AzElasticSanVolumeGroup -ResourceGroupName $RgName -ElasticSANName $EsanName -Name $EsanVgName -EnforceDataIntegrityCheckForIscsi $true
# Set the variable values.
# The name of the resource group where the Elastic San is deployed.
RgName="<ResourceGroupName>"
# The name of the Elastic SAN.
EsanName="<ElasticSanName>"
# The name of volume group within the Elastic SAN.
EsanVgName= "<VolumeGroupName>"
# Create the Elastic San.
az elastic-san volume-group create \
--elastic-san-name $EsanName \
--resource-group $RgName \
--volume-group-name $EsanVgName \
--data-integrity-check true
使用此程式碼範例,透過 PowerShell 為您的彈性 SAN 磁碟區群組建立私人端點。 以您自己的值取代 RgName、VnetName、SubnetName、EsanName、EsanVgName、PLSvcConnectionName、EndpointName 和 Location(區域) 的值:
# Set the resource group name.
$RgName = "<ResourceGroupName>"
# Set the virtual network and subnet, which is used when creating the private endpoint.
$VnetName = "<VnetName>"
$SubnetName = "<SubnetName>"
$Vnet = Get-AzVirtualNetwork -Name $VnetName -ResourceGroupName $RgName
$Subnet = $Vnet | Select -ExpandProperty subnets | Where-Object {$_.Name -eq $SubnetName}
# Set the Elastic SAN, which is used when creating the private endpoint service connection.
$EsanName = "<ElasticSanName>"
$EsanVgName = "<ElasticSanVolumeGroupName>"
$Esan = Get-AzElasticSan -Name $EsanName -ResourceGroupName $RgName
# Create the private link service connection, which is input to creating the private endpoint.
$PLSvcConnectionName = "<PrivateLinkSvcConnectionName>"
$EsanPlSvcConn = New-AzPrivateLinkServiceConnection -Name $PLSvcConnectionName -PrivateLinkServiceId $Esan.Id -GroupId $EsanVgName
# Create the private endpoint.
$EndpointName = '<PrivateEndpointName>'
$Location = '<Location>'
$PeArguments = @{
Name = $EndpointName
ResourceGroupName = $RgName
Location = $Location
Subnet = $Subnet
PrivateLinkServiceConnection = $EsanPlSvcConn
}
New-AzPrivateEndpoint @PeArguments # -ByManualRequest # (Uncomment the `-ByManualRequest` parameter if you are using the two-step process).
如果您使用雙步驟流程,請使用此程式碼範例來核准私人連結服務連線。 使用先前程式碼範例中的相同變數:
# Get the private endpoint and associated connection.
$PrivateEndpoint = Get-AzPrivateEndpoint -Name $EndpointName -ResourceGroupName $RgName
$PeConnArguments = @{
ServiceName = $EsanName
ResourceGroupName = $RgName
PrivateLinkResourceType = "Microsoft.ElasticSan/elasticSans"
}
$EndpointConnection = Get-AzPrivateEndpointConnection @PeConnArguments |
Where-Object {($_.PrivateEndpoint.Id -eq $PrivateEndpoint.Id)}
# Approve the private link service connection.
$ApprovalDesc="<ApprovalDesc>"
Approve-AzPrivateEndpointConnection @PeConnArguments -Name $EndpointConnection.Name -Description $ApprovalDesc
# Get the private endpoint connection anew and verify the connection status.
$EndpointConnection = Get-AzPrivateEndpointConnection @PeConnArguments |
Where-Object {($_.PrivateEndpoint.Id -eq $PrivateEndpoint.Id)}
$EndpointConnection.PrivateLinkServiceConnectionState
使用 Azure CLI 為彈性 SAN 磁碟區群組部署私人端點牽涉到三個步驟:
取得彈性 SAN 的私人連線資源識別碼。
使用輸入建立私人端點:
私人連線資源識別碼
磁碟區群組名稱
資源群組名稱
子網路名稱
虛擬網路名稱
(選擇性 如果您使用雙步驟流程 (建立,然後核准)):彈性 SAN 網路管理員核准連線。
使用此程式碼範例,透過 Azure CLI 為您的彈性 SAN 磁碟區群組建立私人端點。 如果您使用雙步驟流程,請取消註解 --manual-request 參數。 將所有範例變數值取代為您自己的值:
# Define some variables.
# The name of the resource group where the resources are deployed.
RgName="<ResourceGroupName>"
# The name of the subnet from which access to the volume group will be configured.
VnetName="<VnetName>"
# The name of the virtual network that includes the subnet.
SubnetName="<SubnetName>"
# The name of the Elastic SAN that the volume group belongs to.
EsanName="<ElasticSanName>"
# The name of the Elastic SAN Volume Group to which a connection is to be created.
EsanVgName="<ElasticSanVolumeGroupName>"
# The name of the new private endpoint
EndpointName="<PrivateEndpointName>"
# The name of the new private link service connection to the volume group.
PLSvcConnectionName="<PrivateLinkSvcConnectionName>"
# The region where the new private endpoint will be created.
Location="<Location>"
# The description provided for the approval of the private endpoint connection.
ApprovalDesc="<ApprovalDesc>"
# Get the id of the Elastic SAN.
id=$(az elastic-san show \
--elastic-san-name $EsanName \
--resource-group $RgName \
--query 'id' \
--output tsv)
# Create the private endpoint.
az network private-endpoint create \
--connection-name $PLSvcConnectionName \
--name $EndpointName \
--private-connection-resource-id $id \
--resource-group $RgName \
--vnet-name $VnetName \
--subnet $SubnetName \
--location $Location \
--group-id $EsanVgName # --manual-request
# Verify the status of the private endpoint connection.
PLConnectionName=$(az network private-endpoint-connection list \
--name $EsanName \
--resource-group $RgName \
--type Microsoft.ElasticSan/elasticSans \
--query "[?properties.groupIds[0]=='$EsanVgName'].name" -o tsv)
az network private-endpoint-connection show \
--resource-name $EsanName \
--resource-group $RgName \
--type Microsoft.ElasticSan/elasticSans \
--name $PLConnectionName
若要為屬於另一個 Microsoft Entra 租用戶之虛擬網路中的子網路新增網路規則,請使用完整的 VirtualNetworkResourceId 參數,格式為 "/subscriptions/subscription-ID/resourceGroups/resourceGroup-Name/providers/Microsoft.Network/virtualNetworks/vNet-name/subnets/subnet-name"。
移除虛擬網路規則。
## You can remove a virtual network rule by object, by resource ID, or by removing all the rules in a volume group
### remove by networkRule object
Remove-AzElasticSanVolumeGroupNetworkRule -ResourceGroupName myRGName -ElasticSanName mySANName -VolumeGroupName myVolGroupName -NetworkAclsVirtualNetworkRule $virtualNetworkRule1,$virtualNetworkRule2
### remove by networkRuleResourceId
Remove-AzElasticSanVolumeGroupNetworkRule -ResourceGroupName myRGName -ElasticSanName mySANName -VolumeGroupName myVolGroupName -NetworkAclsVirtualNetworkResourceId "myResourceID"
### Remove all network rules in a volume group by pipeline
((Get-AzElasticSanVolumeGroup -ResourceGroupName myRGName -ElasticSanName mySANName -VolumeGroupName myVolGroupName).NetworkAclsVirtualNetworkRule) | Remove-AzElasticSanVolumeGroupNetworkRule -ResourceGroupName myRGName -ElasticSanName mySANName -VolumeGroupName myVolGroupName
若要為屬於另一個 Microsoft Entra 租用戶之虛擬網路中的子網路新增規則,請使用完整的子網路識別碼,格式為 /subscriptions/\<subscription-ID\>/resourceGroups/\<resourceGroup-Name\>/providers/Microsoft.Network/virtualNetworks/\<vNet-name\>/subnets/\<subnet-name\>。
您可以使用 subscription 參數,為屬於另一個 Microsoft Entra 租用戶的虛擬網路擷取子網路識別碼。
# First, get the current length of the list of virtual networks. This is needed to ensure you append a new network instead of replacing existing ones.
virtualNetworkListLength = az elastic-san volume-group show -e $sanName -n $volumeGroupName -g $RgName --query 'length(networkAcls.virtualNetworkRules)'
az elastic-san volume-group update -e $sanName -g $RgName --name $volumeGroupName --network-acls virtual-network-rules[$virtualNetworkListLength] "{virtualNetworkRules:[{id:/subscriptions/subscriptionID/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/$VnetName/subnets/default, action:Allow}]}"