你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
了解如何使用 Azure PowerShell 部署 Azure 资源管理器模板来创建 ExpressRoute 线路。 有关开发资源管理器模板的详细信息,请参阅 资源管理器文档 和 模板参考。
在您开始之前
创建和预配 ExpressRoute 线路
Azure 快速入门模板 有一个很好的资源管理器模板集合。 使用 现有模板 之一创建 ExpressRoute 线路。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.5.6.12127",
"templateHash": "14062891962288443864"
}
},
"parameters": {
"circuitName": {
"type": "string",
"metadata": {
"description": "This is the name of the ExpressRoute circuit"
}
},
"serviceProviderName": {
"type": "string",
"metadata": {
"description": "This is the name of the ExpressRoute Service Provider. It must exactly match one of the Service Providers from List ExpressRoute Service Providers API call."
}
},
"peeringLocation": {
"type": "string",
"metadata": {
"description": "This is the name of the peering location and not the ARM resource location. It must exactly match one of the available peering locations from List ExpressRoute Service Providers API call."
}
},
"bandwidthInMbps": {
"type": "int",
"metadata": {
"description": "This is the bandwidth in Mbps of the circuit being created. It must exactly match one of the available bandwidth offers List ExpressRoute Service Providers API call."
}
},
"skuTier": {
"type": "string",
"defaultValue": "Standard",
"allowedValues": [
"Standard",
"Premium"
],
"metadata": {
"description": "Chosen SKU Tier of ExpressRoute circuit. Choose from Premium or Standard SKU tiers."
}
},
"skuFamily": {
"type": "string",
"defaultValue": "MeteredData",
"allowedValues": [
"MeteredData",
"UnlimitedData"
],
"metadata": {
"description": "Chosen SKU family of ExpressRoute circuit. Choose from MeteredData or UnlimitedData SKU families."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"resources": [
{
"type": "Microsoft.Network/expressRouteCircuits",
"apiVersion": "2021-02-01",
"name": "[parameters('circuitName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[format('{0}_{1}', parameters('skuTier'), parameters('skuFamily'))]",
"tier": "[parameters('skuTier')]",
"family": "[parameters('skuFamily')]"
},
"properties": {
"serviceProviderProperties": {
"serviceProviderName": "[parameters('serviceProviderName')]",
"peeringLocation": "[parameters('peeringLocation')]",
"bandwidthInMbps": "[parameters('bandwidthInMbps')]"
}
}
}
]
}
若要查看更多相关模板,请选择 此处。
若要使用部署模板创建 ExpressRoute 线路,请执行以下操作:
从以下代码块中选择“ 试用” ,然后按照说明登录到 Azure Cloud Shell。
$circuitName = Read-Host -Prompt "Enter a circuit name" $location = Read-Host -Prompt "Enter the location (i.e. centralus)" $resourceGroupName = "${circuitName}rg" $templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.network/expressroute-circuit-create/azuredeploy.json" $serviceProviderName = "Equinix" $peeringLocation = "Silicon Valley" $bandwidthInMbps = 500 $sku_tier = "Premium" $sku_family = "MeteredData" New-AzResourceGroup -Name $resourceGroupName -Location $location New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -circuitName $circuitName -serviceProviderName $serviceProviderName -peeringLocation $peeringLocation -bandwidthInMbps $bandwidthInMbps -sku_tier $sku_tier -sku_family $sku_family Write-Host "Press [ENTER] to continue ..."SKU 层 确定 ExpressRoute 线路是 本地线路、标准线路还是 高级线路。 你可以指定“本地”、“*标准”或“高级”。
SKU 系列 确定计费类型。 可以为 按流量计费的数据计划指定 Metereddata ,并为无限制的数据计划指定 Unlimiteddata 。 可以将计费类型从 Metereddata 更改为 Unlimiteddata,但不能将类型从 Unlimiteddata 更改为 Metereddata。 本地线路仅提供无限数据。
对等互连位置 是与Microsoft对等互连的物理位置。
重要
对等互连位置指示使用Microsoft对等互连 的物理位置 。 此对等互连位置 未 链接到“位置”属性,该属性指 Azure 网络资源提供程序所在的地理位置。 虽然它们不相关,但最好选择靠近线路对等互连位置的网络资源提供程序。
资源组名称是追加了 rg 的服务总线命名空间名称。
选择“复制”以复制 PowerShell 脚本。
右键单击 shell 控制台并选择“粘贴” 。
创建事件中心需要一些时间。
Azure PowerShell 用于在本教程中部署模板。 有关其他模板部署方法,请参阅:
取消预配和删除 ExpressRoute 线路
可以通过选择 “删除 ”图标来删除 ExpressRoute 线路。 请注意以下信息:
- 必须取消所有虚拟网络与 ExpressRoute 线路的链接。 如果此操作失败,请检查是否有虚拟网络链接到了该线路。
- 如果 ExpressRoute 线路服务提供商预配状态为“正在预配”或“已预配”,则必须与服务提供商合作以在服务商端取消预配线路。 在服务提供商完成取消线路预配并通知我们之前,我们会继续保留资源并向你收费。
- 将服务提供商预配状态设置为 “未预配”后,可以删除线路。 删除线路后,其计费也将停止。
可以通过运行以下 PowerShell 命令来删除 ExpressRoute 线路:
$circuitName = Read-Host -Prompt "Enter the same circuit name that you used earlier"
$resourceGroupName = "${circuitName}rg"
Remove-AzExpressRouteCircuit -ResourceGroupName $resourceGroupName -Name $circuitName
后续步骤
创建线路后,请继续执行以下后续步骤: