Creating Service Bus authorization rules with ARM errors out

Intro

In my current project we use Azure Resource Manager (ARM) templates to help with deployments across multiple subscriptions and environments. One of the elements of the ARM template is adding a couple of Shared Access Policies to enable Read and Write on the queues we have in place. The policies have been defined on Service Bus level because they span multiple queues.

Our ARM template functioned just fine, (automated) deployment was up & running and life was beautiful. Until our automated deployment to our development environment triggered in the night of January 24th. Our ARM template, not having been changed for a while, suddenly errored out with a Bad Request. The message read:

Request payload is not in the expected format.

Searching for the issue

We checked everything: API versions (still version 2015-08-01, so no changes there), variables we introduced (no changes there) and parameters. We even stripped out all dynamic behavior just to be sure that wasn’t the cause. And it wasn’t.

The offending part of the ARM template (the one that had functioned before) looked like this:
{
    "apiVersion": "2015-08-01",
    "name": "[concat(variables('servicebus_namespace_name'), '/', 'RoleName')]",
    "type": "Microsoft.ServiceBus/namespaces/authorizationRules",
    "dependsOn": [
"[concat('Microsoft.ServiceBus/namespaces/', variables('servicebus_namespace_name'))]"
     ],
    "location": "[variables('location')]",
    "properties": {
        "Rights": [
            //"Send",
            "Listen"
            //"Manage"
]
}
}

I found an article Create a Service Bus authorization rule for namespace and queue using an Azure Resource Manager template. One of the things in that article is an exmple, that also holds a piece of template to create an Authorization Rule on Service Bus level:

{
    "apiVersion": "[variables('sbVersion')]",
    "name": "[variables('namespaceAuthRuleName')]",
    "type": "Microsoft.ServiceBus/namespaces/authorizationRules",
    "dependsOn": ["[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"],
    "location": "[resourceGroup().location]",
    "properties": {
        "Rights": ["Send"]
}
}

I put the two parts next to each other and started removing all differences between the two. Spacing, newlines… I made sure everything matched. And what do you know? The damned thing worked.

Several tries (and failures) later, I now know what caused our ARM template to fail. It were the comments in the Rights element.

Solution

In the end, the only thing I had to do to get our template working again was remove the comments in the Rights element. I did try with several different comments (with and without a comma in there, for instance) but the comments I tried all made the template fail. As said earlier, the template worked earlier, including the comments. The fact that there are comments all over the place in our ARM template makes it even stranger…

Hope this helps.

Unable to attach remote debugger after Visual Studio 2015 Update 2

As the title states: I was unable to attach the remote debugger (for instance to an Azure Web App) after installing Visual Studio 2015 Update 2. I got an error with something about invalid memory access or something like that.

The solution is simple: install Remote Tools for Visual Studio 2015 Update 2. Go to the webite, pick your machine’s architecture (the x86 install won’t run on a x64 machine) and click download. After installing, you’re good to go!

Hope this helps.

PS: There’s a list of Related releases on the Visual Studio 2015 Update 2 page. Have a look, it’s helpful ;)

Exception with EF code first migrations

Just ran into an exception when running both update-database and add-migration in the Package Manager Console for an EF Code First project. The Exception read:

The type initializer for ‘System.Data.Entity.Migrations.DbMigrationsConfiguration`1’ threw an exception.

The cause? An invalid config file for the project I was trying to run the tools for. So: if you run into this exception, check your configs ;)

Error saving Galileo Wiring App in Visual Studio

'The operation could not be completed' error when saving Galileo Wiring AppLast week I received my Intel Galileo board (from windowsondevices.com) and I started playing with developing for it yesterday. I created a first test project, but it didn’t run. Visual Studio couldn’t find the Arduino header file, which was probably due to a missing NuGet package (the Galileo C++ SDK). I tried to save the project, because you need to before you can manage NuGet packages, but to no avail. Visual Studio served me a ‘The operation could not be completed’ error without any additional information.

imageA while ago I posted about some handy settings in Visual Studio like Zero-impact projects & Cutting/copying empty lines. Turns out that the Windows for IoT project template does some extra things upon creation. And with the ‘Save new projects when created’ checkbox unchecked, it’s not able to do that. Rendering the project unsaveable…

 

The solution

It’s as easy as it is ugly to have to do this: simply check the checkbox in ‘Save new projects when created’ before creating your Windows for IoT project. Then you’re good to go…!

Hope this helps

Fixing the Remote Desktop Connection to a Virtual Machine in Microsoft Azure

A few minutes before my second session at the Dutch Techdays started I tried connecting to my Virtual Machine in Microsoft Azure through remote desktop. It didn’t connect… The RDP client tried to connect to the Virtual Machine, but nothing happened.

So I rebooted the VM and tried connecting again, confident that this would solve the problem. It didn’t connect…. again. As I started stressing out a bit (the VM was the main character of my session) I thought of one last thing I could try.

Fixing the issue

The next steps helped me save my Virtual Machine without too much loss of time (I was able to connect again just before the start of my session!):

  • Go to the Azure Management Portal
  • Open up the details of the VM you’re having trouble with
  • Go to the ENDPOINTS tab (see image below)
  • Select the ‘Remote Desktop’ endpoint and click EDIT at the bottom of the screen
  • Change the public port to a different (random) number
  • Wait for the changes to be propagated
  • Success!

Azure Management Portal

Hope this helps.

Error comparing historic versions of a TFS source controlled file

These files are not text files and cannot be opened in the comparison window.

When working with Visual Studio 2012 on our current project, the error ‘These files are not text files and cannot be opened in the comparison window.’ shows up every now and again. I’ve tried several things to solve this problem.

Here’s the one that works:

  • Close Visual Studio
  • Navigate to your version of the ‘c:\users\{username}\AppData\Local\Temp\’ folder
  • Delete the TFSTemp folder
  • Restart Visual Studio and try again. You should be good to go!

Hope this helps.

ScriptErrors opening (a new tab of) IE10 on a Windows 7 machine

An error has occured in the script on this page. Unable to get property 'style' of undefined or null reference.I’ve been running into the error message on the right (“Unable to get property ‘style’ of undefined or null reference”) when opening an instance or a new tab of IE10 for the past couple of weeks. It didn’t matter what start page I used, since I tried about:blank, google.com and approximately a dozen more. I found out McAfee SiteAdvisor was the cause of this error pretty quick, but since the company I’m currently in doesn’t allow users to disable SiteAdvisor and I needed IE10 for some testing purposes, I had to find a different solution to the problem.

I found a workaround which will do for now: in IE10, go to ‘Tools’ then ‘Compatibility View Settings’ and check ‘Display all websites in Compatibility View’. This will, as you imagined, open all pages in Compatibility View which causes the errors to stop popping up. It is not an ideal solution, but it’s better than closing a script error message for every single IE instance or tab that is opened. Besides, it’s pretty easy to get IE to render as true IE10 in stead of Compatibility View by changing the browser mode to IE10 in the F12 developer tools.

Good to know: after changing browser mode to normal IE10 in a tab, the error doesn’t occur in that tab for the current or subsequent pages you visit while it maintains the Browser Mode. Of course new instances and new tabs will have Compatibility View enabled again.

Hope this helps

Solution for the scripterror caused by McAfee SiteAdvisor in IE10.

Error: The Path ‘path’ is already mapped in workspace ‘workspace’

Just a quick little post today: I got the error “The Path ‘path’ is already mapped in workspace ‘workspace'” when I connected to a new Team Foundation Server and tried to map my workspace today. I had connected to a Team Foundation Services project a while back to get some shared code, but I already removed the workspace and the server binding. Even though Visual Studio didn’t see any other bindings, mapping my workspace to the same folder the previous TFS binding was mapped to served me this error.

The quick solution: manually edit (or remove if you don’t have any other bindings) the file VersionControl.config, which can be found under %AppData%LocalMicrosoftTeam Foundation4.0Cache

Hope this helps.

Visual Studio 2012 crashes when opening an ASP.NET MVC project with a cshtml open

vscrash A rather long title for this post, but that’s exactly what happened: when I opened an ASP.NET MVC 4 project with a cshtml view open, Visual Studio would crash with the error messages seen on the right. This would only occur if the first project I opened had a cshtml file open. When I opened another (type of) project first and then opened a project with a cshtml file open, the problem did not occur. Debugging Visual Studio with a new instance of Visual Studio (Inception anyone?) made things a bit clearer. (Part of) the exception information:

Source
WebEssentials2012

Message
Could not load type ‘Microsoft.Less.Core.LessMixinDeclaration’ from assembly ‘Microsoft.VisualStudio.Web.Extensions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

After searching around a bit, I found this blog post by Mads Kristensen: Web Tools 2012.2 and Web Essentials. This post talks about Web Tools 2012.2 and Web Essentials 2.5, and how an error can occur if you install Web Tools 2012.2 and don’t upgrade to Web Essentials 2.5. However, I do have Web Essentials 2.5.1 installed so this issue shouldn’t be the same as mine.

Although my situation didn’t match the one on Mads’s blog, I decided to install Web Tools 2012.2 just to see what the result would be. As it turned out, installing the Web Tools 2012.2 did solve the problem. Here’s why I think this solved it:

I had an older version of WebEssentials installed, which included specific functionality. This functionality was moved to Web Tools, and out of the new version of Web Essentials. When I updated to the new version of Web Essentials (without having Web Tools installed!), the functionality was no longer available in Web Essentials giving me the ‘Could not load type’ exception.
I’m not sure why the exception did not occur when I opened a different project first or if this is the exact reason of the exception occurring. I’ll contact Mads to share my findings, he might be able to reproduce this.

Hope this helps

Microsoft Touch Mouse, Visual Studio (2012) and scrolling

My Microsoft Touch Mouse stopped scrolling in Visual Studio on my Windows 8 machine some time ago. Because this kills productivity, I wanted to fix the problem. After trying some things I found that the problem only occurred when I ran Visual Studio as Administrator. Searching a bit further I found this bug to be added to Microsoft Connect. I found a workaround for the problem:

  • Go to the location where you have Microsoft Mouse and Keyboard Center installed
  • Open up the properties of ipoint.exe
  • Set it to Run as Administrator
  • Kill and restart ipoint.exe (or restart the machine)
  • Welcome back scrolling in Visual Studio…!

Hope this helps