New-AzRoleAssignment
Hozzárendeli a megadott RBAC-szerepkört a megadott taghoz a megadott hatókörben.
A parancsmag a bemeneti paramétereknek megfelelően meghívhatja a Microsoft Graph API-t:
- GET /users/{id}
- GET /servicePrincipals/{id}
- GET /groups/{id}
- GET /directoryObjects/{id}
Figyelje meg, hogy ez a parancsmag kimenetként Unknown
jelenik ObjectType
meg, ha a szerepkör-hozzárendelés objektuma nem található, vagy a jelenlegi fiók nem rendelkezik elegendő jogosultsággal az objektumtípus lekéréséhez.
Syntax
New-AzRoleAssignment
-ObjectId <String>
[-Scope <String>]
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-ObjectId <String>
-ResourceGroupName <String>
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-ObjectId <String>
-ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
[-ParentResource <String>]
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-ObjectId <String>
-Scope <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
-RoleDefinitionId <Guid>
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-SignInName <String>
-ResourceGroupName <String>
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-SignInName <String>
-ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
[-ParentResource <String>]
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-SignInName <String>
[-Scope <String>]
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-ApplicationId <String>
-ResourceGroupName <String>
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-ApplicationId <String>
-ResourceGroupName <String>
-ResourceName <String>
-ResourceType <String>
[-ParentResource <String>]
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-ApplicationId <String>
[-Scope <String>]
-RoleDefinitionName <String>
[-Description <String>]
[-Condition <String>]
[-ConditionVersion <String>]
[-ObjectType <String>]
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzRoleAssignment
-InputFile <String>
[-AllowDelegation]
[-SkipClientSideScopeValidation]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
A Hozzáférés megadásához használja a New-AzRoleAssignment parancsot. A hozzáférést úgy biztosítjuk, hogy a megfelelő RBAC-szerepkört rendeljük hozzájuk a megfelelő hatókörben. A teljes előfizetéshez való hozzáférés biztosításához rendeljen hozzá egy szerepkört az előfizetés hatókörében. Ha hozzáférést szeretne adni egy adott erőforráscsoporthoz egy előfizetésen belül, rendeljen hozzá egy szerepkört az erőforráscsoport hatóköréhez. Meg kell adni a hozzárendelés tárgyát. Felhasználó megadásához használja a SignInName vagy a Microsoft Entra ObjectId paramétereket. Biztonsági csoport megadásához használja a Microsoft Entra ObjectId paramétert. Microsoft Entra-alkalmazás megadásához használja az ApplicationId vagy ObjectId paramétereket. A hozzárendelt szerepkört a RoleDefinitionName paraméterrel kell megadni. Meg lehet adni azt a hatókört, amelyen a hozzáférés meg van adva. Alapértelmezés szerint a kijelölt előfizetés. A hozzárendelés hatóköre az alábbi a paraméterkombinációk egyikével adható meg. Hatókör – Ez a teljes hatókör az /subscriptions/<subscriptionId> b azonosítóval kezdődően. ResourceGroupName – hozzáférés biztosítása a megadott erőforráscsoporthoz. c. ResourceName, ResourceType, ResourceGroupName és (opcionálisan) ParentResource – adott erőforrás megadása egy erőforráscsoporton belül a hozzáférés biztosításához.
Példák
1. példa
New-AzRoleAssignment -ResourceGroupName rg1 -SignInName allen.young@live.com -RoleDefinitionName Reader -AllowDelegation
Olvasói szerepkör-hozzáférés biztosítása egy felhasználó számára egy erőforráscsoport hatókörében, és a szerepkör-hozzárendelés elérhető a delegáláshoz
2. példa
Get-AzADGroup -SearchString "Christine Koch Team"
DisplayName Type Id
----------- ---- --------
Christine Koch Team 2f9d4375-cbf1-48e8-83c9-2a0be4cb33fb
New-AzRoleAssignment -ObjectId 2f9d4375-cbf1-48e8-83c9-2a0be4cb33fb -RoleDefinitionName Contributor -ResourceGroupName rg1
Hozzáférés biztosítása biztonsági csoporthoz
3. példa
New-AzRoleAssignment -SignInName john.doe@contoso.com -RoleDefinitionName Owner -Scope "/subscriptions/86f81fc3-b00f-48cd-8218-3879f51ff362/resourcegroups/rg1/providers/Microsoft.Web/sites/site1"
Hozzáférés biztosítása egy felhasználó számára egy erőforrásban (webhelyen)
4. példa
New-AzRoleAssignment -ObjectId 5ac84765-1c8c-4994-94b2-629461bd191b -RoleDefinitionName "Virtual Machine Contributor" -ResourceName Devices-Engineering-ProjectRND -ResourceType Microsoft.Network/virtualNetworks/subnets -ParentResource virtualNetworks/VNET-EASTUS-01 -ResourceGroupName Network
Csoporthoz való hozzáférés biztosítása beágyazott erőforrásban (alhálózaton)
5. példa
$servicePrincipal = New-AzADServicePrincipal -DisplayName "testServiceprincipal"
New-AzRoleAssignment -RoleDefinitionName "Reader" -ApplicationId $servicePrincipal.ApplicationId
Olvasói hozzáférés biztosítása szolgáltatásnévhez
Paraméterek
-AllowDelegation
A delegálás jelzője szerepkör-hozzárendelés létrehozásakor.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ApplicationId
A ServicePrincipal alkalmazásazonosítója
Type: | String |
Aliases: | SPN, ServicePrincipalName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Condition
A RoleAssignmentre alkalmazandó feltétel.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ConditionVersion
A feltétel verziója.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
Az Azure-ral való kommunikációhoz használt hitelesítő adatok, fiók, bérlő és előfizetés
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Description
A szerepkör-hozzárendelés rövid leírása.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-InputFile
A szerepkör-hozzárendelés json-elérési útja
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectId
A felhasználó, csoport vagy szolgáltatásnév Microsoft Entra Objectid azonosítója.
Type: | String |
Aliases: | Id, PrincipalId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectType
Az ObjectId azonosítóval való használathoz. Az asignee objektum típusát adja meg
Type: | String |
Aliases: | PrincipalType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ParentResource
A hierarchia szülőerőforrása (a ResourceName paraméterrel megadott erőforrásé). Csak ResourceGroupName, ResourceType és ResourceName paraméterekkel együtt használható hierarchikus hatókör létrehozásához egy erőforrást azonosító relatív URI formájában.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
Az erőforráscsoport neve. Létrehoz egy, a megadott erőforráscsoportban érvényes hozzárendelést. A ResourceName, ResourceType és (opcionálisan)ParentResource paraméterekkel együtt használva a parancs egy hierarchikus hatókört hoz létre egy relatív URI formájában, amely azonosít egy erőforrást.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceName
Az erőforrás neve. Például storageaccountprod esetén. Csak ResourceGroupName, ResourceType és (opcionálisan)ParentResource paraméterekkel együtt használható hierarchikus hatókör létrehozásához egy erőforrást azonosító relatív URI formájában.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceType
Az erőforrás típusa. Például Microsoft.Network/virtualNetworks esetén. Csak ResourceGroupName, ResourceName és (opcionálisan)ParentResource paraméterekkel együtt használható hierarchikus hatókör létrehozásához egy erőforrást azonosító relatív URI formájában.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RoleDefinitionId
Annak az RBAC-szerepkörnek az azonosítója, amelyet hozzá kell rendelni az egyszerű felhasználóhoz.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-RoleDefinitionName
Annak az RBAC-szerepkörnek a neve, amelyet hozzá kell rendelni az egyszerű felhasználóhoz, például olvasó, közreműködő, virtuális hálózat Rendszergazda istrator stb.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Scope
A szerepkör-hozzárendelés hatóköre. Relatív URI formátumban. Például: "/subscriptions/9004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/TestRG". Ha nincs megadva, a szerepkör-hozzárendelést előfizetési szinten hozza létre. Ha meg van adva, az "/subscriptions/{id}" kezdetűnek kell lennie.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SignInName
A felhasználó e-mail-címe vagy egyszerű felhasználóneve.
Type: | String |
Aliases: | Email, UserPrincipalName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SkipClientSideScopeValidation
Ha meg van adva, hagyja ki az ügyféloldali hatókör érvényesítését.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Bevitelek
Kimenetek
Jegyzetek
Kulcsszavak: azure, azurerm, arm, erőforrás, felügyelet, vezető, erőforrás, csoport, sablon, üzembe helyezés
Kapcsolódó hivatkozások
Visszajelzés
https://aka.ms/ContentUserFeedback.
Hamarosan elérhető: 2024-ben fokozatosan kivezetjük a GitHub-problémákat a tartalom visszajelzési mechanizmusaként, és lecseréljük egy új visszajelzési rendszerre. További információ:Visszajelzés küldése és megtekintése a következőhöz: