Last active
February 4, 2024 13:20
-
-
Save neerajks77/b093a5da2e05c7896e64abd2009b06a7 to your computer and use it in GitHub Desktop.
This script will create the service principal in Azure AD and will be used for Azure Automation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This function creates an Azure AD Service Principal | |
function CreateServicePrincipal { | |
param($username, $password) | |
$credproperties = @{ | |
StartDate = Get-Date | |
EndDate = Get-Date -Year 2024 | |
Password = $password | |
} | |
$cred= New-Object Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential -Property $credproperties | |
$sp = New-AzAdServicePrincipal -DisplayName $username -PasswordCredential $cred | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment