Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 未找到Azure服务器场_Powershell_Azure - Fatal编程技术网

Powershell 未找到Azure服务器场

Powershell 未找到Azure服务器场,powershell,azure,Powershell,Azure,我正在尝试通过powershell脚本创建azure网站。托管计划已经创建,我只是想添加一个新的网站到它 我使用的脚本是: Switch-AzureMode AzureResourceManager $targetServicePlan = Get-AzureResource -Name my-serviceplan -OutputObjectFormat New New-AzureResource -Name MyTestSite -Location "West Europe" `

我正在尝试通过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

我遗漏了什么?

您在“西欧”的$TARGETSERVICE计划是什么?如果不是这样的话,那可能就是这个没有多大帮助的错误的原因。

这正是问题所在,它发生在北欧。真令人沮丧。