'未经授权'错误创建应用程序服务计划
不知道它到底在哪里失败。我正在使用VS代码来创建以下脚本并仅从那里运行:
$ResourceGroupName="powershell-grp"
$Location="North Europe"
$AppServicePlanName="PowershellAppService1975"
$WebAppName="PowershellWebApp1975"
Connect-AzAccount
Get-AzSubscription -SubscriptionName "Visual Studio Enterprise" | Select-AzSubscription
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
New-AzAppServicePlan -Name $AppServicePlanName -Location $Location -Tier "B1" -NumberofWorkers 1 -ResourceGroupName $ResourceGroupName
New-AzWebApp -ResourceGroupName $ResourceGroupName -Name $WebAppName -Location $Location -AppServicePlan $AppServicePlanName
在PowerShell控制台中,我会收到此错误: new-azappserviceplan:c:\ temp \ azurecmds \ azure powershell-webapp \ Script1.ps1.ps1:9:1 线| 9 | new -azappservserviceplan -name $ appserviceplanname -location $ location -t… | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ |操作返回了无效的状态代码“未经授权”
new-azwebapp:c:\ temp \ azurecmds \ azure powershell-webapp \ script1.ps1.ps1:10:1:1 线| 10 | new -azwebapp -ResourceGroupName $ resourcegroupname -Name $ webAppName… | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ |操作返回了无效状态代码“未经授权”
Don't know where exactly it is failing. I'm using VS Code to create the following script and running from there only:
$ResourceGroupName="powershell-grp"
$Location="North Europe"
$AppServicePlanName="PowershellAppService1975"
$WebAppName="PowershellWebApp1975"
Connect-AzAccount
Get-AzSubscription -SubscriptionName "Visual Studio Enterprise" | Select-AzSubscription
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
New-AzAppServicePlan -Name $AppServicePlanName -Location $Location -Tier "B1" -NumberofWorkers 1 -ResourceGroupName $ResourceGroupName
New-AzWebApp -ResourceGroupName $ResourceGroupName -Name $WebAppName -Location $Location -AppServicePlan $AppServicePlanName
And in the powershell console, i get this error:
New-AzAppServicePlan: C:\Temp\AzureCmds\Azure Powershell-WebApp\Script1.ps1:9:1
Line |
9 | New-AzAppServicePlan -Name $AppServicePlanName -Location $Location -T …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Operation returned an invalid status code 'Unauthorized'
New-AzWebApp: C:\Temp\AzureCmds\Azure Powershell-WebApp\Script1.ps1:10:1
Line |
10 | New-AzWebApp -ResourceGroupName $ResourceGroupName -Name $WebAppName …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Operation returned an invalid status code 'Unauthorized'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用的-debug cmdlet选项提供了有关此问题的确切信息。
资源组位置支持了所选应用程序服务计划的0个实例。因此,已将应用程序服务计划和Web应用程序部署到完全不同的位置
Used -debug cmdlet option that gave the exact info on the issue.
The resource group location supported 0 instances for the chosen app service plan. Therefore, deployed app service plan and the web app to an altogether different location