New-AzureADUserAppRoleAssignment

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

구문

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 "Your Application display name" | select Approles | Fl 

이 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: <Value that will be transmitted as a claim in a token for this role>
       }
       }
형식:String
Position:Named
Default value:None
필수:True
파이프라인 입력 허용:False
와일드카드 문자 허용:False

-InformationAction

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

  • 계속
  • 무시
  • 문의
  • SilentlyContinue
  • 중지
  • 일시 중지됨
형식:ActionPreference
별칭:infa
Position:Named
Default value:None
필수:False
파이프라인 입력 허용:False
와일드카드 문자 허용:False

-InformationVariable

정보 변수를 지정합니다.

형식:String
별칭:iv
Position:Named
Default value:None
필수:False
파이프라인 입력 허용:False
와일드카드 문자 허용:False

-ObjectId

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

형식:String
Position:Named
Default value:None
필수:True
파이프라인 입력 허용:True
와일드카드 문자 허용:False

-PrincipalId

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

형식:String
Position:Named
Default value:None
필수:True
파이프라인 입력 허용:False
와일드카드 문자 허용:False

-ResourceId

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

형식:String
Position:Named
Default value:None
필수:True
파이프라인 입력 허용:False
와일드카드 문자 허용:False