Every time I open a azure powershell windows is it possible to auto login ?
i.e. this command given below should run everytime I open Azure Command window.
Get-AzurePublishSettingsFile (path in local machine)
or even Add-AzureAccount
You can actually do it. Follow this process:
Open the Azure PowerShell initialization file at "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\ShortcutStartup.ps1" for 64-bit OS or "C:\Program Files\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\ShortcutStartup.ps1" for 32-bit OS.
Add the following code just after the statement $VerbosePreference="Continue"
$username = "<username>"
$password = "<password>"
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($userName, $secpasswd)
Add-AzureAccount -Credential $cred
That should do the auto login for you
@Update: For Azure ARM mode, the command would be Login-AzureRMAccount -Credential $cred
. This might not work with Microsoft accounts though.