Category: Microsoft

Unit Test Class ReSharper Template and Snippets for nUnit and MS Test

Quick helper boiler plates for setting up your Unit Test.

I have included ReSharper Template here that you can import directly Resharper Templates. Also thanks you to Alessandro Aeberli for making the these Visual Studio Snippets

After importing the ReSharper Templates then you can use ‘uTestBoiler’ or ‘uTestnUnitBoiler’ shortcuts to add the code below into any test class.

If you want to make your own snippets you can use the Visual Studios Snippet Manager by following the instructions here https://msdn.microsoft.com/en-us/library/ms165394.aspx

Continue reading “Unit Test Class ReSharper Template and Snippets for nUnit and MS Test”

My Microsoft Azure Certification Revision Sheets

I finally successfully passed the three exams necessary to certify as a Microsoft MCSD: Azure Solution Architect (now becoming the MCSE: Cloud Platform and Infrastructure). \o/

  • Exam 70-532: Developing Microsoft Azure Solutions
  • Exam 70-533: Implementing Microsoft Azure Infrastructure Solutions
  • Exam 70-534: Developing Microsoft Azure Solutions

It was no easy feat, not least because of the absolutely massive number of topics that you need to learn, but also that Microsoft decided to update the syllabus’s of all three exams just as I was ready to take them (Nov/Dec 2016). Continue reading “My Microsoft Azure Certification Revision Sheets”

How to delete an Azure Active Directory (ADD) Tenant

You may have discovered that deleting an Azure Active Directory is a particularly frustrating experience that ultimately ends in failure. The new portal have improved things a bit, by running through a series of check before the delete button is enabled.

You may need to go back to the Classic portal (https://manage.windowsazure.com) to see some of the objects/resources to delete.

However, although this will help you remove ‘most’ of what you need to, unfortunately NOT all!

In this case I got a “Unable to delete directory

Continue reading “How to delete an Azure Active Directory (ADD) Tenant”

Azure App Service – Force redirect from HTTP to HTTPS the easy way!

Once you have uploaded your SSL certificates to your Azure App Service and then configured the bindings (if you are using your own custom domains), there are two ways to force ALL requests to be redirected  from HTTP to HTTPS. The ‘Developer way‘ and the ‘Easy, no code way‘! Continue reading “Azure App Service – Force redirect from HTTP to HTTPS the easy way!”

Creating an Azure Virtual Network with VPN Gateway entirely with PowerShell not possible!

As I found the documentation for this somewhat lacking (especially for New-AzureRmVirtualNetworkGateway and New-AzureRmVirtualNetworkGatewayIpConfig), I thought I would try and see if it was possible to create and fully configure a Virtual Network and Gateway using PowerShell. I have posted my PowerShell script examples and efforst here.

NOTE: Several of these command return  a warning (shown below) which means things will be changing soon…again 😉 …and other just exception, so although you can setup a Virtual Network you can not create the Gateway!

2017-01-05_15-39-25

I am using version 3.3.0 of the Azure cmdlets.

# Get Azure cmdlets version
Get-Module -ListAvailable -Name Azure -Refresh

Steps

  1. Setup variables, login and set current context
    # Setup Variables
    $location = "North Europe"
    $rgName = "MyResourceGroup"
    $strgAccount = "MyStorageAccount"
    $vnetName = "vnet-1"
    $gatewayPIPName = "gateway-2-pip"
    $clientAddressPool = "192.168.0.0/16"
    $gatewayName = "mygateway1"
    
    # Setup PowerShell Environment
    Add-AzureRmAccount
    Select-AzureRmSubscription -SubscriptionName "MySubscription"
    Set-AzureRmCurrentStorageAccount -ResourceGroupName $rgName -Name $strgAccount
    # get and check current context (ARM)
    Get-AzureRmContext
  2. Create the Virtual Network (include a subnet called ‘GatewaySubnet‘ specifically for the VPN Gateway. It appears this is required even if using the Portal to add a Gateway to a Virtual Network.)
    # Create the Virtual Network with 3 subnets)
    # Setup Subnets
    $gatewaySubnet = New-AzureRmVirtualNetworkSubnetConfig `
        -Name GatewaySubnet -AddressPrefix "10.1.0.0/24"
    $frontendSubnet = New-AzureRmVirtualNetworkSubnetConfig `
        -Name frontendSubnet -AddressPrefix "10.1.1.0/24"
    $backendSubnet = New-AzureRmVirtualNetworkSubnetConfig `
        -Name backendSubnet -AddressPrefix "10.1.2.0/24"
    # Create VNet
    $vnet = New-AzureRmVirtualNetwork -Name $vnetName `
        -ResourceGroupName $rgName -Location $location `
        -AddressPrefix "10.1.0.0/16" `
        -Subnet $gatewaySubnet,$frontendSubnet,$backendSubnet
  3. Create a Public IP Address (PIP) to be used by the Gateway
    # Create a PIP
    $pip = New-AzureRmPublicIpAddress -AllocationMethod Dynamic `
        -ResourceGroupName $rgName -Location $location `
        -Name $gatewayPIPName
  4. Create the VNet Gateway (Attempt 1Although I can’t see any issues in the script below, unfortunately this is returning a 500 Internal Server Error. I have tried a number of variations!!)
    # Gateway config
    $vnetGatewayIPConf = New-AzureRmVirtualNetworkGatewayIpConfig -Name default `
        -PublicIpAddress $pip -Subnet $gatewaySubnet
    # Create VNet Gateway
    $vnetGateway = New-AzureRmVirtualNetworkGateway -Name "hmstraingateway1" 
        -ResourceGroupName $rgName `
        -Location $location `
        -IpConfigurations $vnetGatewayIPConf `
        -GatewayType Vpn `
        -VpnType RouteBased `
        -GatewaySku Basic `
        -VpnClientAddressPool $clientAddressPool

     

Attempt 2: I then thought I would see if it would be possible to complete the process using ARM Templates. When attempting to get an ARM Template for an existing Virtual Network Gateway we get the following errors.

Error details - Microsoft Azure 
  • The schema of resource type 'Microsoft.Network/virtualNetworkGateways' is 
    not available. Resources of this type will not be exported to the template. 
    (Code: ResourceTypeSchemaNotFound)
  • The schema of resource type 'Microsoft.Web/connections' is not available. 
    Resources of this type will not be exported to the template. 
    (Code: ResourceTypeSchemaNotFound)

This effectively indicates that the ARM capability of this type of resource is not yet all there in Azure. I seem to come across issue like this quite a lot.

Also with the ARM Virtual Network you can’t use the Get-AzureVNetConfig to download the configuration files either.

So in conclusion the only way to currently create a Gateway and complete the process, is to use the Azure Portal. Please comment below if you know of another way or have spotted an issue.

Links

New-AzureRmVirtualNetworkGatewayIpConfig (https://docs.microsoft.com/en-us/powershell/resourcemanager/azurerm.network/v2.1.0/new-azurermvirtualnetworkgatewayipconfig)

New-AzureRmVirtualNetworkGateway (https://docs.microsoft.com/en-us/powershell/resourcemanager/AzureRM.Network/v1.0.13/New-AzureRmVirtualNetworkGateway?redirectedfrom=msdn)

Save

OneNote backups and clearing out old installation backups and cache.

If, like me, you are an avid user of OneNote then you may have some pretty large notebooks.

What many don’t know is that OneNote has a backup feature that can take up a lot of space.

To get access to the backups simply go to the ‘File’ > ‘Info’ and you will see the ‘Open Backups’ button on the far right.

2017-01-05_11-16-35

You can review and change the backup settings from ‘File’ > ‘Options’ > ‘Save & Backup’.

The backups are extremely useful, however after an upgrade the backups made by the previous version are also left on your drives and now serve no purpose.

You can find the backups in the following location (unless you have chosen an alternate folder)

%USERPROFILE%\AppData\Local\Microsoft\OneNote

Use ‘Windows Key+r’ and copy this into the Run dialogue.

2017-01-05_09-39-36

and you may see the more than one version like below. The backups are in the appropriately named ‘Backup‘ folder.

Delete Backups from previous OneNote versions

2017-01-05_09-38-11

As shown above, you may have more than one version still on your drive.

It may be quite safe to delete the whole folder of the previous version ‘/15.0/’, but just to be safe I only deleted everything in the Backup and OneNoteOfflineCache_Files folders. These took up most of the space.