[英]Credentials for Powershell Azure management cmdlets
What are the options to authenticate the powershell azure management cmdlets like New-AzureSqlDatabaseServer
and New-AzureSqlDatabase
? 有什么方法可以验证New-AzureSqlDatabaseServer
Azure管理cmdlet(如New-AzureSqlDatabaseServer
和New-AzureSqlDatabase
?
It looks like New-AzureSqlDatabaseServer
needs the administrator's user name and password explicitly passed whereas New-AzureSqlDatabase
needs to know the context (Context can be created using Get-Credential
cmdlet or by manually creating an object of type PSCredential
by passing plain text password) 看起来New-AzureSqlDatabaseServer
需要显式传递管理员的用户名和密码,而New-AzureSqlDatabase
需要知道上下文(可以使用Get-Credential
cmdlet或通过传递纯文本密码手动创建PSCredential
类型的对象来创建上下文)
Wondering if there are other ways to authenticate these management cmdlets without passing/prompting for the admin user name or password? 想知道是否还有其他方法可以对这些管理cmdlet进行身份验证,而无需通过/提示输入管理员用户名或密码? I am looking for something in the lines of publish settings certificate that could be imported once to the deployment servers. 我正在寻找可以一次导入到部署服务器的发布设置证书行。
Background - I am looking to automate the SQL azure server and database creation using powershell and trying to do this without having to prompt/pass admin password 背景 -我正在寻找使用Powershell自动化SQL Azure服务器和数据库创建的方法,并尝试执行此操作而不必提示/传递管理员密码
So, New-AzureSqlDatabaseServer
uses your subscription credentials. 因此, New-AzureSqlDatabaseServer
使用您的订阅凭据。 You can currently create a context for use with New-AzureSqlDatabase
using a PSCredential
, which you can create by instantiating a SecureString
for the password - the ConvertTo-SecureString
commandlet can help with this. 当前,您可以使用PSCredential
创建与New-AzureSqlDatabase
使用的上下文,可以通过实例化密码的SecureString
来创建该上下文New-AzureSqlDatabase
ConvertTo-SecureString
Commandlet可以帮助您解决此问题。
I was looking for the same thing and I found a trick to get it... 我一直在寻找相同的东西,但发现了一个窍门...
$cred=Get-Credential
$userName=$cred.UserName
$password=$cred.GetNetworkCredential().Password
New-AzureSqlDatabaseServer -Version "12.0" -AdministratorLogin $userName -AdministratorLoginPassword $password -Location "West US"
Reference: Decrypt PowerShell Secure String Password 参考: 解密PowerShell安全字符串密码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.