【问题标题】:Azure deployment slot creation in azure not working在 azure 中创建 Azure 部署槽不起作用
【发布时间】:2021-01-27 20:28:49
【问题描述】:

我正在尝试通过 powershell 脚本在 Octopus 的 azure app 环境中创建一个插槽 这是我的脚本,

$resourceGroupName = $OctopusParameters["ResourceGroupName"]
$name = $OctopusParameters["Name"]
New-AzureRmWebAppSlot -ResourceGroupName $resourceGroupName -Name $name -Slot blue

它在开发环境中有效,但在 UAT 中无效。我可以确认两个环境是相同的。 我检查了所有内容,在 azure 和 octopus 中看起来完全一样

我得到的错误如下

Calamari.exe : CloseError: The client '976C13ED-5E0E-45C2-8E7A-6172CD41A523' with object id 
'976C13ED-5E0E-45C2-8E7A-6172CD41A523' does not have authorization to perform action 'Microsoft.Web/sites/read' over  
scope '/subscriptions/87932404-80E8-4895-8F4A-E400E263E3DF/resourceGroups/cyberton-app-uat/providers/Microsoft.Web/sit 
es/cyberton-app-uat' or the scope is invalid. If access was recently granted, please refresh your credentials. 
At C:\Octopus\Work\20200929095107-112805-2926\Bootstrap.ps1:49 char:1 
+ &  "C:\Octopus\OctopusServer\Tools\Calamari.Cloud\9.0.5\Calamari.exe" ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo          : NotSpecified: (CloseError: The...ur credentials.:String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError  
At C:\Octopus\Work\20200929095107-112805-2926\Script.ps1:7 char:1 
+ New-AzureRmWebAppSlot -ResourceGroupName $resourceGroupName -Name $name -Slot blue

我的想法不多了,请你帮忙

谢谢

【问题讨论】:

  • 错误消息显然表明缺少权限。您是否验证了对上述资源的现有角色分配?

标签: azure powershell octopus-deploy


【解决方案1】:

您应该为服务主体“976C13ED-5E0E-45C2-8E7A-6172CD41A523”分配订阅角色。

在 Azure 门户中,找到您的 Azure 订阅,单击 Access Control (IAM),然后单击 Add role assignment。为服务主体分配一个角色(例如贡献者)。

如果觉得订阅角色的权限太大,可以找对应的资源进行同样的角色分配操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-27
    • 2015-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-16
    • 1970-01-01
    相关资源
    最近更新 更多