Set-AzRoleDefinition
Ä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-AzRoleDefinition 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.
Syntax
Set-AzRoleDefinition
-InputFile <String>
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Set-AzRoleDefinition
-Role <PSRoleDefinition>
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Cmdleten Set-AzRoleDefinition 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.
Exempel
Exempel 1: Uppdatera med PSRoleDefinitionObject
$roleDef = Get-AzRoleDefinition "Contoso On-Call"
$roleDef.Actions.Add("Microsoft.ClassicCompute/virtualmachines/start/action")
$roleDef.Description = "Can monitor all resources and start and restart virtual machines"
$roleDef.AssignableScopes = @("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
Set-AzRoleDefinition -Role $roleDef
Exempel 2: Skapa med JSON-fil
Set-AzRoleDefinition -InputFile C:\Temp\roleDefinition.json
<#
Following is a sample updated role definition json for Set-AzRoleDefinition:
{
"Id": "52a6cc13-ff92-47a8-a39b-2a8205c3087e",
"Name": "Updated Role",
"Description": "Can monitor all resources and start and restart virtual machines",
"Actions":
[
"*/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/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]
}
#>
Parametrar
-DefaultProfile
Autentiseringsuppgifter, konto, klientorganisation och prenumeration som används för kommunikation med Azure
Type: | IAzureContextContainer |
Aliases: | AzContext, 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 |
-SkipClientSideScopeValidation
Om du anger det hoppar du över validering av klientsidans omfång.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Indata
Utdata
Kommentarer
Nyckelord: azure, azurerm, arm, resource, management, manager, resource, group, template, deployment
Relaterade länkar
Azure PowerShell
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: Under hela 2024 kommer vi att fasa ut GitHub-problem som feedbackmekanism för innehåll och ersätta det med ett nytt feedbacksystem. Mer information finns i:Skicka och visa feedback för