Azureアカウントのカスタムロールの作成

Azureの組み込みのロールを使用したくない場合は、最小限の権限を持つカスタムロールを作成できます。

カスタムロールを作成するには、次の手順を実行します。

  1. Azure PowerShellで次のスクリプトを実行します。

Import-Module AzureRM.Resources
$role = [Microsoft.Azure.Commands.Resources.Models.Authorization.PSRoleDefinition]::new()
$role.Name = 'Veeam Restore Operator'
$role.Description = 'Permissions for Veeam Direct Restore to Microsoft Azure'
$role.IsCustom = $true
$permissions = @(
'Microsoft.Storage/storageAccounts/listkeys/action',
'Microsoft.Storage/storageAccounts/read',
'Microsoft.Network/locations/checkDnsNameAvailability/read',
'Microsoft.Network/virtualNetworks/read',
'Microsoft.Network/virtualNetworks/subnets/join/action',
'Microsoft.Network/publicIPAddresses/read',
'Microsoft.Network/publicIPAddresses/write',
'Microsoft.Network/publicIPAddresses/delete',
'Microsoft.Network/publicIPAddresses/join/action',
'Microsoft.Network/networkInterfaces/read',
'Microsoft.Network/networkInterfaces/write',
'Microsoft.Network/networkInterfaces/delete',
'Microsoft.Network/networkInterfaces/join/action',
'Microsoft.Network/networkSecurityGroups/read',
'Microsoft.Network/networkSecurityGroups/write',
'Microsoft.Network/networkSecurityGroups/delete',
'Microsoft.Network/networkSecurityGroups/join/action',
'Microsoft.Compute/locations/vmSizes/read',
'Microsoft.Compute/locations/usages/read',
'Microsoft.Compute/virtualMachines/read',
'Microsoft.Compute/virtualMachines/write',
'Microsoft.Compute/virtualMachines/delete',
'Microsoft.Compute/virtualMachines/start/action',
'Microsoft.Compute/virtualMachines/deallocate/action',
'Microsoft.Compute/virtualMachines/instanceView/read',
'Microsoft.Compute/virtualMachines/extensions/read',
'Microsoft.Compute/virtualMachines/extensions/write',

'Microsoft.Compute/disks/read',

'Microsoft.Compute/disks/write',
'Microsoft.Resources/checkResourceName/action',
'Microsoft.Resources/subscriptions/resourceGroups/read',
'Microsoft.Resources/subscriptions/resourceGroups/write',
'Microsoft.Resources/subscriptions/locations/read'
)
$role.Actions = $permissions
$role.NotActions = (Get-AzureRmRoleDefinition -Name 'Virtual Machine Contributor').NotActions
$subs = '/subscriptions/00000000-0000-0000-0000-000000000000'  #use your subscription ID
$role.AssignableScopes = $subs
New-AzureRmRoleDefinition -Role $role

  1. 作成したロールを必要なAzureユーザーに割り当てます。詳細については、「RBAC for Azure resources documentation(AzureリソースのRBACに関するドキュメント)」の「Add or remove role assignments using Azure RBAC and the Azure portal(Azure RBAC と Azure portal を使用してロールの割り当てを追加または削除する)」セクションを参照してください。
  2. Initial Configurationウィザードの[Subscription]のステップで、[Use existing account]を選択して割り当てたロールを持つAzureユーザーを選択します。詳細については、「Microsoft Azureアカウントの追加」を参照してください。

Azureアカウントのカスタムロールの作成 注:

  • スクリプト内にサブスクリプションIDを入力するには、Connect-AzureRmAccountGet-AzureRmSubscriptionを使用する必要があります。
  • このスクリプトは、Microsoft Azure PowerShellバージョン5.1.1用に提供されています。コマンドの命名は、Microsoft Azure PowerShellの他のバージョンでは異なる場合があります。

参照

Create or update custom roles for Azure resources using Azure PowerShell(Azure PowerShell を使用して Azure リソースのカスタム ロールを作成または更新する)