Azure ARM (25) 自定義Role,不允許移動Azure資源 Windows Azure Platform 系列文章目錄

  《Windows Azure Platform 系列文章目錄

 

  我們把一個資源從資源組A移動到資源組B的時候,如果這時候有其他人對資源組A或者資源組B的時候,會遇到創建失敗的錯誤,並且會提示該資源組正在被移動,所以無法部署

  其實我們可以自定義角色(Custom Role),拒絕某些用戶移動Azure資源。

  在創建custom role的時候,需要至少有以下權限:

  • 在源資源組上,需要Microsoft.Resources/subscriptions/resourceGroups/moveResources/action
  • 在目標資源組上,需要Microsoft.Resources/subscriptions/resourceGroups/write

 

  我們可以在custom role的時候,設置如下信息:

  • 自定義Role Name爲CannotMoveResource
  • Action爲*,表示可以執行任何操作,類似於Owner
  • Not Action爲Microsoft.Resources/subscriptions/resourceGroups/moveResources/action,不允許移動資源
{
    "properties": {
        "roleName": "CannotMoveResource",
        "description": "",
        "assignableScopes": [
            "/subscriptions/3851f1a6-e76d-4c8b-b204-0809652cbe98/resourceGroups/20221124-rg"
        ],
        "permissions": [
            {
                "actions": ["*"],
                "notActions": ["Microsoft.Resources/subscriptions/resourceGroups/moveResources/action"],
                "dataActions": [],
                "notDataActions": []
            }
        ]
    }
}

  

 

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章