Script help
I have a test script I run from on-prem which builds a VM in Azure and then connects to the domain.
I use Login-AzureRmAccount in the script to prompt the user to enter the username and password.
Part of my script also joins the PC to the domain using "add-computer –domainname ad.contoso.com -Credential AD\adminuser -restart –force and press Enter"
The user is then asked to enter a password.
But, I I'd like to use a service account to get the pc joining the domain. So, I know I can use the above example using the service account service principal, but of course I am asked for a password, which I don't know. I know i'm missing something here at it may well be easy, how can I get around this? Any tips appreciated.
Thanks