Renew App registration secret with Powershell

Copper Contributor

Hello everyone,


is it possible to create a new secret for an existing app registration via powershell?


Thanks for tips and suggestions in advance!



1 Reply



You can use the API endpoint with method POST (App ID is obscured):


$url = "****-***-*******/addPassword"

$appAssignmentHashtable = @{}
$appAssignmentHashtable.mobileAppAssignments = 
@([ordered]@{ "passwordCredential"= 
        [ordered]@{ "displayname"= "TestTN"; 
                    "endDateTime"= "2024-12-30T10:27:35.455Z";
                    "startDateTime"= "2024-07-03T09:27:35.455Z"


$appAssignmentJSON = $appAssignmentHashtable | ConvertTo-Json -depth 10
$body= $appAssignmentJSON -replace '""','null'

Invoke-MgGraphRequest -Uri $url -Body $body -Method POST -OutputType PSObject


There is also a new Entra Module that can perform this:


New-EntraApplicationPasswordCredential -ObjectId "057702ab-3ea0-******-******"


See here more information: