New-AzureADUserAppRoleAssignment

애플리케이션 역할에 사용자를 할당합니다.

Syntax

New-AzureADUserAppRoleAssignment
   -ObjectId <String>
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   -Id <String>
   -PrincipalId <String>
   -ResourceId <String>
   [<CommonParameters>]

Description

New-AzureADUserAppRoleAssignment cmdlet은 사용자를 Azure AD(Active Directory)의 애플리케이션 역할에 할당합니다.

예제

예제 1: 역할 없이 애플리케이션에 사용자 할당

# Get AppId of the app to assign the user to

$appId = Get-AzureADApplication -SearchString "<Your App's display name>"

# Get the user to be added

$user = Get-AzureADUser -searchstring "<Your user's UPN>"

# Get the service principal for the app you want to assign the user to

$servicePrincipal = Get-AzureADServicePrincipal -Filter "appId eq '$appId'"

# Create the user app role assignment

New-AzureADUserAppRoleAssignment -ObjectId $user.ObjectId -PrincipalId $user.ObjectId -ResourceId $servicePrincipal.ObjectId -Id ([Guid]::Empty)

이 명령은 사용자를 및 애플리케이션에 할당합니다. t에는 역할이 없습니다.

예제 2: 애플리케이션 내의 특정 역할에 사용자 할당

$username = "<You user's UPN>"
$appname = "<Your App's display name>"
$spo = Get-AzureADServicePrincipal -Filter "Displayname eq '$appname'"
$user = Get-AzureADUser -ObjectId $username
New-AzureADUserAppRoleAssignment -ObjectId $user.ObjectId -PrincipalId $user.ObjectId -ResourceId $spo.ObjectId -Id $spo.Approles[1].id

이 cmdlet은 id가 $spo 사용하여 지정된 애플리케이션 역할을 지정된 사용자에게 할당합니다. Approles[1].id. 애플리케이션에 대한 애플리케이션 역할을 검색하는 방법에 대한 자세한 내용은 -Id 매개 변수 설명을 참조하세요.

매개 변수

-Id

할당할 앱 역할의 ID입니다. 역할이 없는 애플리케이션에 대한 새 앱 역할 할당을 만들 때 빈 GUID를 제공하거나 사용자에게 할당할 역할의 ID를 제공합니다.

애플리케이션 개체의 AppRoles 속성을 검사하여 애플리케이션의 역할을 검색할 수 있습니다.

Get-AzureadApplication -SearchString "애플리케이션 표시 이름" | Approles | 선택 플로리다

이 cmdlet은 애플리케이션에 정의된 역할 목록을 반환합니다.

AppRoles: {class AppRole { AllowedMemberTypes: System.Collections.Generic.List1[System.String] Description: description for <this role> DisplayName: <display name for this role> Id: 97e244a2-6ccd-4312-9de6-ecb21884c9f7 IsEnabled: True Value: <이 역할> 의 토큰에서 클레임으로 전송되는 값 } }

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

-InformationAction

이 cmdlet이 정보 이벤트에 응답하는 방법을 지정합니다. 이 매개 변수에 허용되는 값은 다음과 같습니다.

  • 계속
  • 무시
  • 문의
  • SilentlyContinue
  • 중지
  • 일시 중지됨
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationVariable

정보 변수를 지정합니다.

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

-ObjectId

새 앱 역할이 할당될 Azure AD 사용자의 ID(UPN 또는 ObjectId)를 지정합니다.

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

-PrincipalId

새 앱 역할이 할당된 보안 주체의 개체 ID입니다. 사용자에게 새 역할을 할당할 때 사용자의 개체 ID를 제공합니다.

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

-ResourceId

사용자 역할이 할당된 애플리케이션에 대한 서비스 주체의 개체 ID입니다.

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

참고

Microsoft Graph PowerShell 에 대한 New-AzureADUserAppRoleAssignment에 대한 마이그레이션 가이드 를 참조하세요.