App registration using Powershell - secret/key not showing up in Portal UI

Mads Westen 36 Reputation points
2021-12-29T12:05:47.647+00:00

Hi,
I am trying to automate the process of making app registration for our tenants/customers using Powershell.
I got things up and running in test, but one thing is strange.
In my test I have created app registration manually using the steps with creating redirect url, API permission and client secret.
On that app I now try to create new secret/key using Powershell with this cmd:
New-AzureADApplicationPasswordCredential -ObjectId $app.ObjectId -CustomKeyIdentifier "FromPowershell" -StartDate $startDate -EndDate $endDate -Value $keyValue

Things runs like a charm, and I get response back, showing me the expected result.
Now I try to look at certificates and secrets on my app registration, but the list is empty. See image...
If I run Get-AzureADApplicationPasswordCredential -ObjectId $app.ObjectId I get the added key:
PS C:\Windows\system32> Get-AzureADApplicationPasswordCredential -ObjectId $app.ObjectId

CustomKeyIdentifier : {70, 114, 111, 109...}
EndDate : 29-12-2119 10:09:22
KeyId : 3f6aa47b-3d29-4d8b-a10b-4cf53c8bcab3
StartDate : 29-12-2021 10:09:22
Value :
The key works, but I am no to keen on putting onto production when I cannot see the key in the Portal UI.
What am I doing wrong?
161201-appregistration-nokeys.png

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Answer accepted by question author
  1. Siva-kumar-selvaraj 15,731 Reputation points Volunteer Moderator
    2021-12-29T16:11:45.527+00:00

    Hello @Mads Westen ,

    Thanks for reaching out.

    Extending the expiration date is not supported, but as you mentioned you can create new credential to use a custom value instead by using the following cmdlet, which allows you to set prior PasswordCredentials granted to the application.

    New-AzureADApplicationPasswordCredential -ObjectId 34c04e6c-a0e1-46be-b0c2-14f1fb052391 -Value "Nez6kRbXgtphaIU0kQy2Jnn5SCj1CVMAV1xTYL8ABEU=" -CustomKeyIdentifier Test

    161139-image.png

    Hope this helpful.

    -----
    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.