0

I have two applications (ui and api) in Azure Active Directory. How do I add ui application id to knownClientApplications list in api application manifest via PowerShell script?

user989988
  • 3,006
  • 7
  • 44
  • 91
  • Could you include additional details like what you tried and where you stuck with code and errors by editing your question? – Sridevi Mar 11 '23 at 07:18
  • Currently I added the id manually. But I would like to add it automatically via a script. – user989988 Mar 14 '23 at 16:55

1 Answers1

0

I tried to reproduce the same in my environment and got below results:

I created one App registration named API App like below:

enter image description here

Now, I registered one Azure AD registration named UI App like below:

enter image description here

To add this UI App application id to knownClientApplications list in API App application manifest via PowerShell, you can use below script:

$UIAppId = "c94e5f5f-c2b6-4a14-82a4-xxxxxxx"
$API0bjectId = "861f810d-a48f-4cb0-9b71-xxxxxxxx"

Set-AzureADApplication -ObjectId $API0bjectId -KnownClientApplications $UIAppId

Response:

enter image description here

When I checked the same in Portal, UI App ID added successfully to knownClientApplications list in API App application manifest like below:

enter image description here

If you want to set Authorized client applications from PowerShell, you can refer below link:

How do you set preAuthorizedApplications using Powershell by SaurabhSharma-MSFT

Sridevi
  • 10,599
  • 1
  • 4
  • 17