在Azure门户中,我已经完成了设置一个新的vNet虚拟网络的向导。在创建之前,我已经从Azure门户下载了包含JSON的zip文件包,并取消了创建
使用Azure中保持不变的两段JSON (附件),我使用了一个简单的2行Powershell脚本…
$resourceGroupName = "RG-SBX-MYTEST"
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name deploy_vNet -TemplateFile "C:\Azure\vNet\template.json" -TemplateParameterFile "C:\Azure\vNet\parameters.json"
当它运行时,它会提示我输入nameFromTemplate和resourceGroupFromTemplate,,但是parameters.json文件中的所有其他值都被认为是…???
cmdlet New-AzureRmResourceGroupDeployment at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
nameFromTemplate: vNet-SBX-MYTEST
resourceGroupFromTemplate: RG-SBX-MYTEST
DeploymentName : deploy_vNet
ResourceGroupName : RG-SBX-MYTEST
ProvisioningState : Succeeded
Timestamp : 19/02/2019 12:00:28
Mode : Incremental
TemplateLink :
Parameters :
Name Type Value
=============== ========================= ==========
name String vNet-SBX-MYTEST
resourceGroup String RG-SBX-MYTEST
location String westeurope
addressPrefix String 10.1.0.0/16
subnetName String default
subnetAddressPrefix String 10.1.0.0/24
enableDdosProtection Bool False
Outputs :
DeploymentDebugLogLevel :
我不明白这里有什么问题?请帮帮忙,这应该很简单,对吧??对于参数文件已有的值,我不希望有两个提示
提前感谢!
parameters.json文件
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "vNet-SBX-MYTEST"
},
"location": {
"value": "westeurope"
},
"resourceGroup": {
"value": "RG-SBX-MYTEST"
},
"addressPrefix": {
"value": "10.1.0.0/16"
},
"subnetName": {
"value": "default"
},
"subnetAddressPrefix": {
"value": "10.1.0.0/24"
},
"enableDdosProtection": {
"value": false
}
}
}
template.json文件
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string"
},
"resourceGroup": {
"type": "string"
},
"location": {
"type": "string"
},
"addressPrefix": {
"type": "string"
},
"subnetName": {
"type": "string"
},
"subnetAddressPrefix": {
"type": "string"
},
"enableDdosProtection": {
"type": "bool"
}
},
"resources": [
{
"apiVersion": "2018-08-01",
"name": "[parameters('name')]",
"type": "Microsoft.Network/virtualNetworks",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('addressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters('subnetAddressPrefix')]"
}
}
],
"enableDdosProtection": "[parameters('enableDdosProtection')]"
}
}
] }
https://stackoverflow.com/questions/54769789
复制相似问题