Add New SSH Login to Azure Linux VM

Some time ago, I created an Ubuntu virtual machine in Azure using a password-based login. Over time, I got annoyed with having to enter the password each time I logged in, so I decided to switch over to using SSH public keys. Unfortunately, the Azure documentation regarding such a scenario assumes only that you will be creating a new virtual machine from scratch to create a public key based login. Have no fear. I have figured out how to do this without having to recreate your virtual machine.

Requirements

  • Linux-based client (your computer)
  • Linux-based virtual machine in Azure with password-based login (Azure)

Create the RSA Keys on Your Computer

Azure requires RSA keys with 2048-bit encryption, so you should do this:

Just press ENTER when asked where to store the file unless you really want to put it somewhere other than the default. In most cases, the default is fine. After you pick the location, enter a good password to unlock the private key when prompted during login.

Transfer the Keys from Your Computer to Your Server

In order to copy your keys to the server on which you want to login, you will need to have a password-based login already setup. If this is your case, do the following:

Enter your server’s password-based login when prompted to begin the copying process.

Confirm Your Key Based Login Works

Do this and enter your previously created key’s decryption password:

References

https://help.ubuntu.com/community/SSH/OpenSSH/KeysRead more

A Quick Reference to Azure Key Vault via Powershell

Azure Key Vault has been generally available in certain regions since June 2015. You can’t use the Azure Portal to work with the key vault yet, so you have to drop down into Azure Powershell and run a few commands. It’s a little confusing to get started since development is ongoing and Azure Powershell itself changes frequently.

Here’s how I have been achieving some simple Azure Key Vault commands via Azure Powershell. I’m using Azure Powershell version 0.9.8, so keep that in mind if you’re comparing these commands to the Getting Started guide linked previously in this article.

Check Your Azure Powershell Version (optional)

If you don’t know what version of Azure Powershell you’re using, try this:

Switch to AzureResourceManager Mode if Necessary (optional)

Since you’re using version 0.9.8 like me, you need to switch into Azure Resource Manager mode.

Login to Azure

Login to your Azure account and enter your credentials in the popup window. It seems kind of odd that it wouldn’t just make you login via Powershell parameters.

Create a Resource Group (optional)

You need an Azure Resource Group to add the Azure Key Vault to. If you don’t have one already, create it now. If you already have one, skip this step.

Create a Key Vault

Now create the Azure Key Vault. To be honest, I don’t know what would happen if you added it to a location that’s different from the Resource Group’s location.

Create a Key and Add It to Your Key Vault

Now you need to add a Key to your Key Vault. This cmdlet will create a software-protected key. You could also create a hardware-protected key, but keep in mind that there may be costs associated with that method of extra protection.

Confirm the Key Was Created

Read more thorough documentation here.Read more

Redirect your azurewebsites.net URL to your custom domain URL

If you’ve attached a custom domain to your Azure Websites setup, you probably want people and search engine crawlers to use the custom domain URL instead of the free azurewebsites.net URL. You can setup your application’s web.config to include the following.

Add the following to the system.webServer section of your web.config, but make sure you replace the “yourdomain” text with your own domain information.

Read more

Setting up a custom domain with Namecheap and Azure Websites

There are a ton of domain name registrars and hosts out there. Finding specific instructions to match the two together is something a bit of a challenge. To make things tougher, instructions aren’t always updated when user interfaces and processes are changed in the tools provided by these services. Hopefully, this article will provide simple instructions.

  1. Log in to your Azure account and go to the management portal.
    • Your website must be set to “Shared”, “Basic” or “Standard” tiers in order to use custom domains.
    • If you want to eventually setup SSL on your custom domain, you will need to set the website to “Basic” or “Standard” tier.
    • Read more on pricing.
  2. Navigate to the dashboard of the Azure Website you are working with.
  3. In the bottom toolbar, click “Manage Domains”.
  4. Make note of the IP address listed at the bottom of the popup.
  5. Log in to your Namecheap account.
  6. Under “account information”, click to view your domains.
  7. On the left sidebar, click “Your Domains”.
  8. Click the domain you want to connect with Azure from the middle section.
  9. On the left sidebar, click “All Host Records”.
  10. Copy the IP address from step 4 to the IP Address / URL of the root host name “@”. Change that record type to “A Record”.
  11. Copy the “xxx.azurewebsites.net” domain name to the IP Address / URL of the host name “www” where “xxx” is your website name. Change that record type to “CNAME”.
  12. Under the subdomains section, add “awverify” and “awverify.www” subdomains. Set both IP Address / URL to awverify.xxx.azurewebsites.net where “xxx” is your website name. Change those record types to “CNAME”.
  13. Save your changes. Wait until the DNS records propogate. Sometimes this takes awhile (over 24 hours). In my case, it took about an hour.
  14. Go back to your Azure dashboard, add the domain and any subdomains to the popup from step 4. For example, “xxx.com” and “www.xxx.com” where “xxx” is your domain name.
Read more

Resolving the problem where “WADLogsTable” is not created in Windows Azure Diagnostics

I’ve been using Windows Azure to host a Worker Role in a Cloud Service for an in-development version of my new app, Steam Community Viewer. This service will allow users to be notified of when their friends come online or start playing a game through Windows 8 Toast Notifications. Additionally, it will push updates to Live Tiles for new Steam deals.

During my tests, I tried to turn diagnostics on, but failed to save them to a permanent storage because the table that gets created when you enable basic logging wasn’t actually being created! Windows Azure Basic Logs will be saved in Azure Storage Tables under “WADLogsTable” based on a logging level (error, critical, verbose, etc…). This table is supposed to be automatically created when the service is uploaded and deployed with tracing enabled. If you find that the official Windows Azure documentation on using diagnostics is not helping you with this task, try the code below in your service OnStart() overload.

Read more