Forum Discussion

Roy Hochstenbach's avatar
Roy Hochstenbach
Copper Contributor
Jan 18, 2018
Solved

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 ...
  • Hannel Hazeley's avatar
    Hannel Hazeley
    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

     

Resources