Set-AzureRmRoleDefinition

Ändrar en anpassad roll i Azure RBAC. Ange den ändrade rolldefinitionen antingen som en JSON-fil eller som en PSRoleDefinition. Använd först kommandot Get-AzureRmRoleDefinition för att hämta den anpassade roll som du vill ändra. Ändra sedan de egenskaper som du vill ändra. Spara slutligen rolldefinitionen med det här kommandot.

Varning

AzureRM PowerShell-modulen är officiellt inaktuell från och med den 29 februari 2024. Användare rekommenderas att migrera från AzureRM till Az PowerShell-modulen för att säkerställa fortsatt support och uppdateringar.

Även om AzureRM-modulen fortfarande kan fungera, underhålls den inte längre eller stöds, vilket gör att användaren kan välja och riskera fortsatt användning. Se våra migreringsresurser för vägledning om övergången till Az-modulen.

Syntax

Set-AzureRmRoleDefinition
   -InputFile <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Set-AzureRmRoleDefinition
   -Role <PSRoleDefinition>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Cmdleten Set-AzureRmRoleDefinition uppdaterar en befintlig anpassad roll i rollbaserad åtkomstkontroll i Azure. Ange den uppdaterade rolldefinitionen som indata till kommandot som en JSON-fil eller ett PSRoleDefinition-objekt. Rolldefinitionen för den uppdaterade anpassade rollen MÅSTE innehålla ID och alla andra obligatoriska egenskaper för rollen även om de inte uppdateras: DisplayName, Beskrivning, Åtgärder, AssignableScopes. NotActions, DataActions, NotDataActions är valfria. Följande är ett exempel på en uppdaterad json för rolldefinition för Set-AzureRmRoleDefinition { "Id": "52a6cc13-ff92-47a8-a39b-2a8205c3087e", "Name": "Updated Role": "Updated Role ", "Beskrivning": "Kan övervaka alla resurser och starta och starta om virtuella datorer", "Åtgärder": [ "/read", "Microsoft.ClassicCompute/virtualmachines/restart/action", "Microsoft.ClassicCompute/virtualmachines/start/action" ], "NotActions": [ "/write" ], "DataActions": [ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" ], "NotDataActions": [ "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write" ], "AssignableScopes": ["/subscriptions/xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxx"] }

Exempel

Uppdatera med PSRoleDefinitionObject

PS C:\> $roleDef = Get-AzureRmRoleDefinition "Contoso On-Call"
          PS C:\> $roleDef.Actions.Add("Microsoft.ClassicCompute/virtualmachines/start/action")
          PS C:\> $roleDef.Description = "Can monitor all resources and start and restart virtual machines"
          PS C:\> $roleDef.AssignableScopes = @("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")

          PS C:\> Set-AzureRmRoleDefinition -Role $roleDef

Skapa med JSON-fil

PS C:\> Set-AzureRmRoleDefinition -InputFile C:\Temp\roleDefinition.json

Parametrar

-DefaultProfile

Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputFile

Filnamn som innehåller en enda json-rolldefinition som ska uppdateras. Inkludera endast de egenskaper som ska uppdateras i JSON. ID-egenskapen är Obligatorisk.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Role

Rolldefinitionsobjekt som ska uppdateras

Type:PSRoleDefinition
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Indata

PSRoleDefinition

Parametrar: Roll (ByValue)

Utdata

PSRoleDefinition

Kommentarer

Nyckelord: azure, azurerm, arm, resource, management, manager, resource, group, template, deployment