Skip to main content

Posts

Showing posts from November, 2016

Logging to Azure : Sequence contains no elements

When developing PowerShell scripts working with Azure it's very convenient to script the login part so you are not prompted each time you tweaked the script and re-run it. You archive this by creating a PSCredential object and passing to it your email and password (converted to a secure string first) as in a snippet below $email='your email' $pwd = 'your password' | ConvertTo-SecureString -AsPlainText -Force $cred = New-Object -TypeName System.Management.Automation.PSCredential  `  -ArgumentList $email, $Pwd Login-AzureRMAccount -credential $cred  This works fine with corporate email addresses but if you try to use your Live ID (Hotmail or Outlook) you get back this error Login-AzureRMAccount : Sequence contains no elements At line:8 char:1 + Login-AzureRMAccount -credential $cred + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : CloseError: (:) [Add-AzureRmAccount], AadAuthenticationFailedException     + FullyQuali

Configuring Azure SQL database to use Key Vault for AlwaysEncrypted columns

Azure SQL v12 databases have the Always Encrypted feature with ability to store cryptographic materials in Azure Key Vault. In this Blog I'll show how to create a Key Vault and configure an Azure SQL database to use the Key Vault for Always Encrypted. The following are the requirements to succeed: Azure subscription with access to the Classic Azure Portal (CSP type subscription doesn't work at the time of the writing) an Azure SQL v12 database (you can create it from PowerShell but I have it already created) Resource Group (you can create it from PowerShell but I also have it already created) Step 1 - log into Azure using the Resource Model $cred = Get-Credential # sign in using the ARM model Login-AzureRmAccount -Credential $cred # Login-AzureRmAccount returns this details: # Environment           : <name> # Account               : <your email> # TenantId              : 4f.................................. # SubscriptionId        : fc...