Cannot add multiple redirect URLs to Azure app

Viewed 71

I am trying to add redirect URLs to Azure Application. I know I can do this from Portal here:

image.png

I ran the below commands in Powershell to do the same:

Connect-AzureAD 
Set-AzureADApplication -ObjectId $app_id -ReplyUrls $Urls  

But I got stuck with this error:

Set-AzureADApplication : Error occurred while executing SetApplication
Code: Authentication_Unauthorized Message: User was not found.
RequestId: redacted DateTimeStamp: Tue, 13
Sep 2022 10:27:33 GMT HttpStatusCode: Forbidden HttpStatusDescription:
Forbidden HttpResponseStatus: Completed At line:1 char:1

Is this possible from Powershell? If there is any query in Graph, that also helps. Any ideas!

Any help is appreciated

1 Answers

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

enter image description here

The error usually occurs if you have multiple tenants in your domain and when you connected to Azure AD without specifying Tenant-ID in the command Connect-AzureAD .

You can find the Tenant-ID in the Portal like below:

enter image description here

To resolve the error, make sure to connect with the Azure AD like below:

Connect-AzureAD -TenantId <your_tenant_Id>

$Urls = "https://jwt.ms","https://jwt.io"
Set-AzureADApplication -ObjectId $app_object_id -ReplyUrls $Urls  

Response:

enter image description here

The Redirect URIs added successfully in the Azure Portal like below:

enter image description here

Related