[英]Azure API Management - How to set the VNET/SubNet using Azure CLI?
I have created my VNET & SubNet as mentioned below我已经创建了我的 VNET 和子网,如下所述
RESOURCE_GROUP="POC-RG"
LOCATION="westus"
APIMNAME="poc-apim-98"
PUBLISHER="Demo"
PUBLISHEREMAIL="myemail@demo.com"
SKU="Premium"
VNETNAME="app-vnet"
APITYPE="External"
az network vnet create \
--resource-group ${RESOURCE_GROUP} \
--name ${VNETNAME} \
--location ${LOCATION}
az network vnet subnet create \
--resource-group ${RESOURCE_GROUP} \
--vnet-name ${VNETNAME} \
--name apim \
--address-prefixes 10.0.5.0/24
and I want to provision the Azure API Management in the apim subnet created above我想在上面创建的 apim 子网中配置 Azure API 管理
az apim create --name ${APIMNAME} -g ${RESOURCE_GROUP} -l ${LOCATION} --sku-name ${SKU} --publisher-email ${PUBLISHEREMAIL} --publisher-name ${PUBLISHER} --virtual-network ${APITYPE}
Looks like Azure CLI does not take the subnet parameter while creating the APIM, how do I set the subnet and create the Azure API Management using azure cli? Looks like Azure CLI does not take the subnet parameter while creating the APIM, how do I set the subnet and create the Azure API Management using azure cli?
You are right.你说的对。 For some reason
az apim create
does not provide option to input a subnet reference of a VNET.出于某种原因,
az apim create
不提供用于输入 VNET 的子网引用的选项。
You have 2 options:您有 2 个选项:
az group deployment create --resource-group <my-resource-group> --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/201-api-management-create-with-external-vnet/azuredeploy.json
Or,或者,
az resource
command to add subnet reference after you create APIM.az resource
命令添加子网引用。az apim create --name ${APIMNAME} -g ${RESOURCE_GROUP} -l ${LOCATION} --sku-name ${SKU} --publisher-email ${PUBLISHEREMAIL} --publisher-name ${PUBLISHER} --virtual-network ${APITYPE}
$apimResourceId = az apim show -n ${APIMNAME} -g ${RESOURCE_GROUP} --query 'id' -o json
$subnetResourceId = az network vnet subnet show -g ${RESOURCE_GROUP} -n apim --vnet-name ${VNETNAME} --query 'id' -o json
az resource update --ids $apimResourceId --set properties.virtualNetworkConfiguration.subnetResourceId=$subnetResourceId
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.