-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy path14_Create_Custom_Role_tw.ps1
More file actions
25 lines (22 loc) · 945 Bytes
/
14_Create_Custom_Role_tw.ps1
File metadata and controls
25 lines (22 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Clear-Host
Set-Location c:\
Connect-AzAccount
Get-AzSubscription
Get-AzRoleDefinition | ft
$customrole = Get-AzRoleDefinition "Virtual Machine Contributor"
$customrole.Id = $null
$customrole.Name = "Virtual Machine Starter"
$customrole.Description = "Provides the ability to start a virtual machine."
$customrole.Actions.Clear()
$customrole.Actions.Add("Microsoft.Storage/*/read")
$customrole.Actions.Add("Microsoft.Network/*/read")
$customrole.Actions.Add("Microsoft.Compute/*/read")
$customrole.Actions.Add("Microsoft.Compute/virtualMachines/start/action")
$customrole.Actions.Add("Microsoft.Authorization/*/read")
$customrole.Actions.Add("Microsoft.Resources/subscriptions/resourceGroups/read")
$customrole.Actions.Add("Microsoft.Insights/alertRules/*")
$customrole.AssignableScopes.Clear()
$customrole.AssignableScopes.Add("/subscriptions/<ihre Subscription ID>")
New-AzRoleDefinition -Role $customrole