azure powershell - Remove-AzureRmSqlDatabase keeps asking me to run LoginAzureRmAccount -




i have azure sql database want delete. command should be:

remove-azurermsqldatabase -resourcegroupname $dbresourcegroup -servername $dbservername -databasename $dbtodelete -whatif -force 

the error keep getting

remove-azurermsqldatabase : run login-azurermaccount login. 

i tried running login-azurermaccount myself, service principal use unattended scripts, , nothing worked.

i able log azure rm portal , delete databases. able run invoke-sqlcmd against database query , manipulate data.

how can make work?

according error message, seems have not login azure whit right subscription.

we can use command sql database's information, , check subscription.

(get-azurermsqldatabase -databasename jasontest1 -servername jasontest -resourcegroupname jasontest).resourceid

then can find subscription in powershell output.

ps c:\users> (get-azurermsqldatabase -databasename jasontest1 -servername jasontest -resourcegroupname jasontest).resourceid /subscriptions/5384xxxx-xxxx-xxxx-xxxx-xxxxe29axxxx/resourcegroups/jasontest/providers/microsoft.sql/servers/jasontest/databases/jasontest1 

to find subscription, can use command get-azurermsubscription list it:

ps c:\users> get-azurermsubscription   name     : visual studio ultimate msdn id       : 5384xxxx-xxxx-xxxx-xxxx-xxxxe29axxxx tenantid : 1fcfxxx-xxxx-xxxx-xxxx9-xxxx8bf8xxxx state    : enabled 

also can use command select subscription:

get-azurermsubscription -subscriptionid 5384xxxx-xxxx-xxxx-xxx-xxxxe29axxxx 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -