除了贡献者之外,哪些 Azure 角色将允许执行 Add-AzureRmAutoscaleSetting
Other than Contributor, what Azure Role will allow the execution of Add-AzureRmAutoscaleSetting
我有一个用于部署 Azure 云服务(经典) 的 Powershell 脚本。直到今天,应用程序用户被分配了一个 Contributor
角色。作为加强安全性的一部分,我们将撤销此 Contributor
角色,因为它太宽泛了。
部署过程的一部分是使用 Add-AzureRmAutoscaleSetting
:
更新生产槽的 AutoScaling 设置
Add-AzureRmAutoscaleSetting -Location "East US" -Name $scalingName -ResourceGroupName $resourceGroup -TargetResourceId $targetResourceId -AutoscaleProfile $autoscaleProfile
由于不再为 Azure 用户分配 Contributor
角色,此命令现在失败,表示它是 "Forbidden":
Add-AzureRmAutoscaleSetting : Exception type: ErrorResponseException, Message: Null/Empty, Code: Null, Status code:Forbidden, Reason phrase: Forbidden
At C:\Path\AzureRMTools.psm1:131 char:5
+ Add-AzureRmAutoscaleSetting -Location "East US" -Name $scalingNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureRmAutoscaleSetting], PSInvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Autoscale.AddAzureRmAutoscaleSettingCommand
我曾尝试为用户分配许多不同的角色(我认为角色会拥有此权限)- 但其中 none 似乎拥有允许我执行此权限的权限。
我想知道哪个角色会包含此权限?如果 none,是否可以创建一个允许执行命令的新角色。
谢谢
任何允许 Microsoft.insights/autoscalesettings/write
在您感兴趣的范围内的角色都应该起作用。
以及您尝试将自动缩放绑定到的资源的权限(写入)
感谢 @4c74356b41 在正确方向上的推动。
角色中似乎没有包含 Microsoft.insights/autoscalesettings/write
权限的任何构建,因此在 this tutorial 之后我创建了一个新角色。
这是我创建的 json
文件:
{
"Name": "Microsoft Insights Contributor",
"IsCustom": true,
"Description": "Allows the creation, edition, and deletion of AutoScaling rules from Microsoft.Insights",
"Actions": [
"Microsoft.Insights/*",
"Microsoft.ClassicCompute/*"
],
"NotActions": [],
"DataActions": [],
"NotDataActions": [],
"AssignableScopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000"
]
}
然后执行以下命令将其添加到您的 Azure 订阅:
New-AzureRmRoleDefinition -InputFile '.\Microsoft Insights Contributor.json'
希望这对其他人有帮助
注意:当我使用 Azure 云服务(经典)时,我还需要一些 Microsoft.ClassicCompute
资源的权限
为了扩展之前的答案,以下是当您的 AutoScale 绑定到经典云服务时所需的特定角色:
"Microsoft.Insights/AutoscaleSettings/Read",
"Microsoft.Insights/AutoscaleSettings/Write",
"Microsoft.ClassicCompute/domainNames/slots/roles/write",
"Microsoft.ClassicCompute/domainNames/slots/roles/read"
我有一个用于部署 Azure 云服务(经典) 的 Powershell 脚本。直到今天,应用程序用户被分配了一个 Contributor
角色。作为加强安全性的一部分,我们将撤销此 Contributor
角色,因为它太宽泛了。
部署过程的一部分是使用 Add-AzureRmAutoscaleSetting
:
Add-AzureRmAutoscaleSetting -Location "East US" -Name $scalingName -ResourceGroupName $resourceGroup -TargetResourceId $targetResourceId -AutoscaleProfile $autoscaleProfile
由于不再为 Azure 用户分配 Contributor
角色,此命令现在失败,表示它是 "Forbidden":
Add-AzureRmAutoscaleSetting : Exception type: ErrorResponseException, Message: Null/Empty, Code: Null, Status code:Forbidden, Reason phrase: Forbidden
At C:\Path\AzureRMTools.psm1:131 char:5
+ Add-AzureRmAutoscaleSetting -Location "East US" -Name $scalingNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureRmAutoscaleSetting], PSInvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Autoscale.AddAzureRmAutoscaleSettingCommand
我曾尝试为用户分配许多不同的角色(我认为角色会拥有此权限)- 但其中 none 似乎拥有允许我执行此权限的权限。
我想知道哪个角色会包含此权限?如果 none,是否可以创建一个允许执行命令的新角色。
谢谢
任何允许 Microsoft.insights/autoscalesettings/write
在您感兴趣的范围内的角色都应该起作用。
以及您尝试将自动缩放绑定到的资源的权限(写入)
感谢 @4c74356b41 在正确方向上的推动。
角色中似乎没有包含 Microsoft.insights/autoscalesettings/write
权限的任何构建,因此在 this tutorial 之后我创建了一个新角色。
这是我创建的 json
文件:
{
"Name": "Microsoft Insights Contributor",
"IsCustom": true,
"Description": "Allows the creation, edition, and deletion of AutoScaling rules from Microsoft.Insights",
"Actions": [
"Microsoft.Insights/*",
"Microsoft.ClassicCompute/*"
],
"NotActions": [],
"DataActions": [],
"NotDataActions": [],
"AssignableScopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000"
]
}
然后执行以下命令将其添加到您的 Azure 订阅:
New-AzureRmRoleDefinition -InputFile '.\Microsoft Insights Contributor.json'
希望这对其他人有帮助
注意:当我使用 Azure 云服务(经典)时,我还需要一些 Microsoft.ClassicCompute
资源的权限
为了扩展之前的答案,以下是当您的 AutoScale 绑定到经典云服务时所需的特定角色:
"Microsoft.Insights/AutoscaleSettings/Read",
"Microsoft.Insights/AutoscaleSettings/Write",
"Microsoft.ClassicCompute/domainNames/slots/roles/write",
"Microsoft.ClassicCompute/domainNames/slots/roles/read"