Azure: no RDP available

Summary: normally, when I create a VM, the RDP connection is setup by default. But tonight, the Connect button on the portal was greyed out, and the RDP link in my local RDP Manager just dumbly timed out. This shows the things to check and add to resolve.

(This before I met the problem). Decided to treat myself to an SSD…

No screenshot, but the VM overview, once created and running, shows the VM both  running AND connectable. However this time the Connect button was greyed out. So from the menu for the VM, I selected Inbound security rules…

This showed that I indeed had no RDP rule:

I went ahead and added a rule…

 

and after a while it is there:


Note that a refresh of the portal left the Connect button still grey, but my DNS entry from the RDP manager now worked, and that’s all I need:

Job done.

Advertisements

Windows 10… N – don’t use it for app development.

At least, if the app in question uses speech. Background is that I routinely use Azure VMs for development… so let’s extend that to writing apps. The ready-made VMs that also include Visual Studio are the “N” variants. So I used them, as usual. However, I wasted a number of hours failing to get to the bottom of this error when executing a pretty standard block of text-to-speech code (at the time I was not questioning whether “N” was OK to use):

MigratingWinPhoneApp15

Class not registered

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.
ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.
HandleNonSuccessAndDebuggerNotification(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
 at HW.MainPage.d__1.MoveNext()} System.Runtime.InteropServices.COMException

I spent a lot of time after that trying to debug, googling up the wrong tree, reinstalling various releases of Visual Studio, all with the same, bad, result. In fact I should have just gone to bed, because as ever a tiny light bulb came on when I thought about… N.

So this morning I googled issues around Visual Studio and Windows N 10, and almost immediately found this:

NotWin10N_05

So I tried the media feature pack, got a message that “does not apply to this installation” or somesuch. Yes I could have persevered, but decided to trash the N instance, and create a non-N instance, and manually install Visual Studio, and this sample. And then it was all fine.

NotWin10N01

And I thought there might be some issue with trying to do speech on a VM, but that was all fine, and came loud and clear through my speakers on my host PC. QED.

 

Chef and Azure: learn.chef.io

I had not looked at the Chef docs for some time. They continue to be excellent. I was using them to see how deploying to Azure differed from a more on-premise VM. As far as I could see, the only difference was making sure that you had enabled the 80,5985 and 443 endpoints/ports in the Azure Portal. No amount of opening firewall ports on the provisioned VM will help if you have not done that.

I also suggest getting things working with the simplest possible test, and making network calls within a single server to start (I know what I mean hopefully you do, too late to explain more 🙂 )

I left comments here and here.

A very helpful post on WinRm and networking difficulties here.

Easiest way to get non-truncated history, btw (hm not so sure now):

h | select -Property CommandLine -unique > x.txt

Session edits.

 

 

Azure ARM: naïve single VM deployment

The aim is to get a real simple VM deployment working using a json template, and in doing that to sacrifice any guidelines on authoring best practice, so we can focus on getting familiar with the nuts and bolts of ARM deployment.

Download the template and PowerShell helper from here.

Assume you need Windows 10 Anniversary edition PowerShell versions for these client/deployment actions.

Open a PowerShell admin prompt in the download location, and run [.\deploy.ps1].

You will be prompted for your Azure login, a resource group and location (e.g. “uksouth”), and an admin password for the VM.

If all goes fine, then you will be able to rdp to the VM, and be able to start up SSMS.

Finally, a couple of pictures I took to focus the mind when trying to reduce the template to the bare minimum to get a working VM:

The next day… in fact I have started to remove the literals as I get more familiar. Again, I refer you the MS Azure docs above.

Docker on Windows: First Steps

Last night I wasted a few hours getting nowhere: various problems with the spec or config of machines I was trying Docker out against not matching up to assumptions in the msdn pages, blogs I was reading. However, remember this is firmly Windows. Sure, I dare say it is a breeze on Linux – I would not know.

Tonight in fact was a much better contrast. I have any number of SQLServer instances running on a single Windows Server 2016 Azure VM.

Let’s take it real slow… The first important step is to grab the right image in Azure for these purposes. One that works is this:

Always select the Resource Manager deployment model:

This is the size I usually pick: shut it down between use and it won’t be too expensive. I would not use 2 cores – I tried one a couple of days back, and it was REALLY slow. This speed is fine, for me:

That takes no more than 10 minutes to create.

Once it has been created, rdp onto it, and you will see that the Docker service is already running:

Then start a PowerShell admin session, and start playing. You will find there are already some images there:

docker images

Try these commands as well:

docker --help

docker --version

Across the Cloud of course the file transfers are blindingly fast – pulling down 10GB images is done in a matter of minutes, so this lot took me a max of minutes I think:


To get a new image, for example the latest SQL Server for Windows (as opposed these days to Linux, for example):

docker pull microsoft/mssql-server-windows

With that downloaded we can start the SQLServer instance:

docker run -d -p 1433:1433 -e sa_password=$dbpw -e ACCEPT_EULA=Y microsoft/mssql-server-windows

How to connect to the SQLServer instance

Run docker ps, and that gives you the Container Ids of all the running Docker… Containers:

docker ps


Stick that container id in a variable for later use, and run the inspect switch to get the ip address of the container..

docker inspect -format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $containerId

I could not see how to get the ip address directly into a variable, so again you have to do that by hand, e.g.

$dbServer="123.45.675.890"

Now test your connectivity with sqlcmd before trying through ssms:

Now see my recent post on SSMS installation, and you see that what you created through the command line now appears in SSMS:

And finally for now shut down the container. In this shot, I try to stop a nonsense container, just to see how failure looks, and then stop the actual container. However I’d like better feedback than that (see the 2 docker stop lines). The second one has presumably silently failed. Trying to run sqlcmd against that ip address now fails… as you would want and expect. And although not shown, [docker ps] returns an empty set.

 

dockertake2_15

I don’t yet know how to run many containers against a single image, but this suggests to me it is possible.


https://blogs.technet.microsoft.com/dataplatforminsider/2016/10/13/sql-server-2016-express-edition-in-windows-containers/

https://store.docker.com/images/1bc596e5-6961-4d12-8465-c0e7c3cad4bb?tab=description

https://hub.docker.com/r/microsoft/mssql-server-windows/

https://hub.docker.com/r/microsoft/mssql-server-windows-express/

https://www.docker.com/products/docker#/azure

https://beta.docker.com/

https://beta.docker.com/docs/azure/

Azure: removing Classic resources

The screenshots below record my attempts.. and I think eventual success in resolving this error, which happens in Classic Azure when you delete a VM… but the dependencies are orphaned because the deletion does not result in a cascade delete. (Later… in fact even though the Classic Portal says you have zero VMs… if you drill in to that, you will/may find images and/or disks that are associated with the storage account you are trying to delete).

The frustration people feel around this inability to delete the orphaned resource can be seen here.

The solution for me anyway used a combination of plugging away at the orphans in the newer Portal, in the classic Portal, and using the Azure Storage Explorer, available here.

PowerShell DSC: Creating IIS things on an Azure VM

I started out with an Azure VM (WS 2012 R2, SQLServer 2016). My aim was to deploy a web application so that the index.html was visible to the external world.

Additions I did not yet manage to achieve in DSC were a) adding endpoints for http and https in ARM, b) setting up self-signed certificates on the host VM. The http part right now is a Must.. the https might be considered optional but sensible.

Right now, this is the exciting output as an external user:

That already highlights one new thing: The UK now has its own Azure data centres… previously I noticed I would often get my browser language in Dutch.

Before I show you the whole of the DSC config, some key points were:

  • the use of the CimSession parameter to Start-DscConfiguration
  • as in a previous post, the need to delete pending configurations… assuming you are sure you don’t want them
  • There seems to be no “Let it be so” option for an existing virtual directory… so might have to replace that with some imperative code.

 

Code here.