Forum Discussion
Roy Hochstenbach
Jan 18, 2018Copper Contributor
Cannot login using ServicePrincipal: Application was not found in the directory
I'm trying to set up an automation script that allows me to start up and shut down virtual machines in Azure without any user input. I've created an application registration (Web app / API) in Azure ...
- Jan 18, 2018
I got an error on the password, below was successful for me
$principalPassword = ConvertTo-SecureString "mypassword123" -AsPlainText -Force New-AzureRmADSpCredential -ServicePrincipalName https://domain.com/xxxxxxxxxxxxx -Password $principalPassword $applicationid ="d35a3b69-98f8-4dbb-abf8-1660ed11fadd" $psCred = New-Object System.Management.Automation.PSCredential($applicationid, $principalPassword) Add-AzureRmAccount -Credential $psCred -ServicePrincipal -TenantId 6f0ebec4-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxx
Hannel Hazeley
Jan 18, 2018Iron Contributor
Not sure what's going on, can you send a screenshot of the process like I did?
Don't forget to block out tenant and application if they are in production.
Also you can get/confirm you tenant name from the Active Directory section.
Roy Hochstenbach
Jan 19, 2018Copper Contributor
I just figured out what was causing this. I was using the Linux version of Powershell which was causing this error message. Your instructions did work on the Windows Powershell. Thanks! :-)