【发布时间】:2015-08-28 06:58:56
【问题描述】:
我正在尝试通过 powershell 脚本创建一个 azure 网站。托管计划已经创建,我只是想添加一个新网站。
我使用的脚本是这样的:
Switch-AzureMode AzureResourceManager
$targetServicePlan = Get-AzureResource -Name my-serviceplan -OutputObjectFormat New
New-AzureResource -Name MyTestSite -Location "West Europe" `
-ResourceGroupName Default-Web-WestEurope `
-ResourceType 'Microsoft.Web/sites' `
-PropertyObject @{"name" = "MyTestSite"; "ServerFarmId" = $targetServicePlan.ResourceId } `
-OutputObjectFormat New
服务器场 ($targetServicePlan) 有一个资源 id,所以我假设它存在(在 azure 门户中也有一个使用此名称的托管计划)。然而,当我尝试创建网站时,出现错误:“找不到名称为 my-serviceplan 的服务器场。”
完整的错误是:
New-AzureResource : {"Code":"NotFound","Message":"Server farm with name my-serviceplan not found.","Target":null,"Details":[{"Message":"Server farm with name
my-serviceplan not found."},{"Code":"NotFound"},{"ErrorEntity":{"Code":"NotFound","Message":"Server farm with name my-serviceplan not
found.","ExtendedCode":"11001","MessageTemplate":"Server farm with name {0} not found.","Parameters":["my-serviceplan"],"InnerErrors":null}}],"Innererror":null}
At line:1 char:1
+ New-AzureResource -Name MyTestSite -Location "West Europe" -ResourceGrou ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureResource], ErrorResponseMessageException
+ FullyQualifiedErrorId : NotFound,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
我错过了什么?
【问题讨论】:
标签: powershell azure