1

What are the options to authenticate the powershell azure management cmdlets like New-AzureSqlDatabaseServer and 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)

Wondering if there are other ways to authenticate these management cmdlets without passing/prompting for the admin user name or password? 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

2 Answers 2

1

So, New-AzureSqlDatabaseServer uses your subscription credentials. 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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

2 Comments

When I call Get-Credential, I get prompted for my credentials. I think infinity didn't want to get prompted for credentials.
Well, I doubt there is a way to get the password without first entering it! That would be very insecure. ;-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.