繁体   English   中英

使用Powershell部署ARM模板:即使已定义subscriptionID,也要询问

[英]Deploying ARM templates using powershell: asking for subscriptionID even when it is defined

我正在尝试使用以前从Azure(使用门户网站)下载的ARM模板和“ deploy.ps1”脚本在Azure上部署服务。 “ deploy.ps1”文件中的部分可以指定订阅ID,资源组等:

param(
  [Parameter(Mandatory=$True)]
  [string]
  $subscriptionId = "ID",

  [Parameter(Mandatory=$True)]
  [string]
  $resourceGroupName = "Name"

   ......

  $templateFilePath = "template.json",
  [string]
  $parametersFilePath = "parameters.json"
  )

即使定义了SubscriptionID,当我执行“ deploy.ps1”脚本时,系统也会不断询问您的订阅ID:

cmdlet deploy.ps1 at command pipeline position 1
Supply values for the following parameters:
subscriptionId:

您能帮我解决这个问题吗?

在这种情况下,错误是由于powershell脚本将某些参数定义为“ Mandatory而导致的,您无法将默认值分配给强制参数(如@Tomalak提示)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM