azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

[Azure Stack] ADFS : New-AzureRmRoleAssignment fails with 'The provided information does not map to an AD object id'

Open bganapa opened this issue 8 years ago • 2 comments

Description

The following command New-AzureRmRoleAssignment -ApplicationId $ServicePrincipal.ApplicationIdentifier -RoleDefinitionName Contributor

fails with

New-AzureRmRoleAssignment : The provided information does not map to an AD object id. At line:1 char:1 New-AzureRmRoleAssignment -ApplicationId $ServicePrincipal.Applicatio CategoryInfo : CloseError: (:) [New-AzureRmRoleAssignment], KeyNotFoundException FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureRoleAssignmentCommand

Script/Steps for Reproduction

pass in the $creds

$session = New-PSSession -ComputerName Azs-ERCS01 -ConfigurationName PrivilegedEndpoint -Credential $creds

$cert = New-SelfSignedCertificate -CertStoreLocation "cert:\CurrentUser\My" -Subject "CN=BalaApp2" -KeySpec KeyExchange

$ServicePrincipal = Invoke-Command -Session $session -ScriptBlock { New-GraphApplication -Name 'BalaApp2' -ClientCertificates $using:cert}
$AzureStackInfo = Invoke-Command -Session $session -ScriptBlock { get-azurestackstampinformation }
$session|remove-pssession
$ServicePrincipal
New-AzureRmRoleAssignment -ApplicationId $ServicePrincipal.ApplicationIdentifier -RoleDefinitionName Contributor

Module Version

AzureRM.Resources - 6.0.2 AzureRM - 2.3.0

Work Around

Using the ClientId for the -ApplicationId parameter work. The namings are confusing.

New-AzureRmRoleAssignment -ApplicationId $ServicePrincipal.ClientId -RoleDefinitionName Contributor -Scope "/subscriptions/618083d8-5d85-4924-bcba-ff7b046e1460"

bganapa avatar Sep 19 '18 19:09 bganapa

@bganapa Is this a bug or a feature request?

deathly809 avatar Dec 04 '18 01:12 deathly809

This is by design, and any changes will break Az.

knithinc avatar Jun 03 '19 22:06 knithinc