In this Azure article, we will discuss the syntax and usage of the New-AzADSpCredential PowerShell command with examples.
This Azure PowerShell cmdlet helps you to add a credential to an existing service principal.
Below is the syntax for the New-AzADSpCredential PowerShell cmdlet.
New-AzADSpCredential -ObjectId <String>
Let’s consider an example. After executing the below PowerShell command, I got the expected credentials for the service principal with the specified object ID.
New-AzADSpCredential -ObjectId fe1edfc6-19c1-49ca-9be9-6cf073186a42
After executing the above command, I got the below-expected output.
CustomKeyIdentifier DisplayName EndDateTime Hint KeyId SecretText StartDateTime ------------------- ----------- ----------- ---- ----- ---------- ------------- 01-11-2025 08:01:28 ULL b98ed9f7-f249-48d0-9cf9-7cb71e25b97f ULL8Q~bBi38~8TRaP0qTPbZJIe3aJIduDwWGabjA 01-11-2023 08...
You can see in the screenshot below that I have executed the above PowerShell command and got the expected output
You may also like following the articles below
In this article, we discussed the syntax and usage of the New-AzADSpCredential PowerShell command with examples.
I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.