Blu*_*uds 4 powershell azure azure-powershell
每次打开azure powershell窗口都可以自动登录吗?
即,每次打开Azure命令窗口时,都应运行下面给出的命令.
Get-AzurePublishSettingsFile(本地计算机中的路径)
甚至Add-AzureAccount
你实际上可以做到这一点.请遵循以下流程:
在64位操作系统或"C:\ Program Files\Microsoft SDKs"的"C:\ Program Files(x86)\ Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\ShortcutStartup.ps1"中打开Azure PowerShell初始化文件Azure\PowerShell\ServiceManagement\Azure\Services\ShortcutStartup.ps1"适用于32位操作系统.
在语句后面添加以下代码 $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
Run Code Online (Sandbox Code Playgroud)
那应该为你自动登录
@Update:对于Azure ARM模式,命令将是Login-AzureRMAccount -Credential $cred.但这可能不适用于Microsoft帐户.
| 归档时间: |
|
| 查看次数: |
11307 次 |
| 最近记录: |