Azure CustomScriptExtension – Are there limits?

Yes, another in a series of disjointed short notes about Azure.

I’ve been buildings PowerShell scripts to automate the build of SQL Server AzureVMs. Part of that effort has been using the Azure Custom Script Extension to help get stuff installed.

The gist of this tool is that, through a simple call in your PowerShell VM Build script, you can pass a file (or multiple files) into your nice fresh AzureVM and have one of them run when they are all downloaded. For example, you could use it to send a SQL Server installation configuration file and a simple PoSh script to complete the installation.

Sounds great. Particularly the “multiple files” bit. However, there does seem to be a snag, in that it doesn’t appear to be hugely reliable when passing in more than a few files.

Scenario: A shiny new SQL Server, and a load of very useful First Aid diagnostic scripts from the lovely Brent Ozar [Brent Ozar blog|@BrentOzarULTD] and his PLF chums. Seven SQL scripts, and one (short and sweet) PowerShell script to run the lot.


The CustomScriptExtension extension failed to download all the scripts. Repeatedly. With the error message

“Failed to download all specified files. Exiting. Error Message: The process cannot access the file ‘C:\\Packages\\Plugins\\Microsoft.Compute.CustomScriptExtension\\1.4\\Downloads\\6\\sp_Blitz.sql’ because it is being used by another process.”

Yeah. You were the only thing access that file. Where’s that “You had one job” meme when you need it?

CustomScriptExtension Limits?

So, are there any limits to the CustomScriptExtension? I don’t think I had reached any sort of size limit, as I put all of Brent’s Blitz queries into one big script and that worked just fine.

In fact, definitely not a size issue – I’ve used the CustomScriptExtension to transfer a 3GB ISO.

I don’t think it’s an issue with multiple file types – as referenced above, I can shift a TXT, ISO and PS1 file in one call.

So. Is there a limit on the number of files that can be (reliably) passed using Set-AzureVMCustomScriptExtension?

Posted in SQLServerPedia Syndication | Tagged , , | Leave a comment

Problems with Azure VMs of different sizes

Just a quick note…

If you’re building an Azure Cloud Service with multiple Virtual Machines of varying sizes, does it matter which order you create Azure VMs?

I created a new Azure Cloud Service by building a machine of size Basic_A3. Next on the build list was a machine of size A5. Except that the New-AzureVM command failed:

New-AzureVM : Compute.CannotUpgradeDeploymentToNewRoleSize : Unable to upgrade the deployment. The requested VM size 'A5' may not be
available in the resources supporting the existing deployment. Please try again later, try with a different VM size or smaller number
of role instances, or create a deployment under an empty hosted service with a new affinity group or no affinity group binding.
At P:\My Documents\WindowsPowerShell\BuildVMs.ps1:359 char:6
+     |New-AzureVM -ServiceName $myServiceName -Location $myLocation -WaitForBoot  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureVM], ComputeCloudException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewAzureVMCommand

On Azure’s portal, hunt for the errors in the deployment logs, and find an XML file, the useful part of which is:

            <Message>Unable to upgrade the deployment. The requested VM size 'A5' may not be available in the resources supporting the existing deployment. Please try again later, try with a different VM size or smaller number of role instances, or create a deployment under an empty hosted service with a new affinity group or no affinity group binding.</Message>

On the off-chance it was a problem with starting off with a machine in the Basic range (sounds like a discount supermarket label), I tried again, creating the service with an A5, adding the Basic_A3 I needed, and then, for fun, adding a Standard_D12. Except that failed with the same problem.

So, to answer my question at the top… Yes. Yes it does matter. Build the biggest one you need first.

Posted in SQLServerPedia Syndication | Tagged , , , , | Leave a comment

Azure Windows Server 2012 VMs – non en-US Locale

Just a quick scream out into the void…

You know when you build a new server, a real one, you get to choose what locale / regionalisation / language settings you want the server to be installed with?

How are you supposed to do that with Azure VMs built from the provided image library?

Unfortunately, it doesn’t appear to be as straightforward as it should be. I found this Feedback ticket on the Azure Forums:

<Insert rant on middle-endian date formats and the lack of take-up of ISO-8601>

Please, all you non-US Azure VM users – go and vote it up!

Posted in SQLServerPedia Syndication | Tagged , | Leave a comment

SQL Server 2016 – New Feature – Stretch DB

This applies to the CTP – it might not apply to any RTM version

Have you been following the SQL Server 2016 at site? I really haven’t had much time to pay attention to this recently, but this one thing in the list of benefits caught my eye.

SQL 2016 Benefits

Stretch Database technology keeps more of your customer’s historical data at your fingertips by transparently stretching your warm and cold OLTP data to Microsoft Azure in a secure manner without application change

Oh, this sounds like it could be useful for just about everyone with a reasonable transaction history to look after for whatever reason – get the data out of your main OLTP database, but still have it accessible for reports, auditing or compliance. Just about every client I’ve ever worked for could benefit from this.

And look – there’s a white paper to download!

SQL 2016 Whitepapers

I’m a sucker for a good whitepaper, so I downloaded and had a little read of the SQL Server 2016 Hyper-scale Cloud technical white paper, as that seemed to be the right one.

Oh, man, this is good stuff. Pages 10-12 of the white paper talk big numbers – a billion row table, 1TB table, 5TB databases, tiered storage. All good, sensible arguments for looking into data archiving. Indeed, this feels a bit magic bulletish.

With SQL Server 2016 Stretch Databases, you can stretch an on-premises table to Azure transparently for near-infinite capacity with low TCO.

The headlines are that things like backup, restore, index maintenance etc, is done only on the local database, the warm/hot data, and not on the stuff that’s been migrated up to the cloud (the cold, archived data). Massive potential speed improvements could result here for the OLTP and maintenance stuff; but anything that uses the cloud data is going to be (not surprisingly) a bit slower.

There are moderate performance reductions when accessing the cold data


The MSDN documentation for the Stretch Database makes this seem less like the magic bullet – well, once you start digging a little.


There are various limitations around this functionality. The ones that drew my eye were that you weren’t allowed to have foreign keys referencing the table that’s being stretched into the cloud. That’s probably not an issue for transaction history records.

Every time you run the wizard to enable Stretch for a database, the wizard creates a new Azure SQL Database server. By default, the number of servers that you can create per subscription is limited.

By default, the wizard creates a SQL Database server with the Standard service tier and the S3 performance level

Now, I’ve been doing some digging in this area recently, and that didn’t seem to me to be so promising. And indeed it isn’t. According to the Azure SQL Database Service Tiers and Performance Levels documentation, the S3 tier has a maximum size for the database of 250GB. (The highest level, Premium/P3, gives 500GB.) Oh, and the maximum size for a blob in storage is also 500GB.

From the white paper talking about multi-terabyte / near infinite archives to the maximum size of a Azure SQL Database being 250GB (or 500, I know…) – something seems to me to be missing, and I (as yet) can’t see what it is.

Yes, this is only a CTP of SQL Server 2016, and things might change in the Azure architecture. But that’s a big shortfall.

Posted in SQLServerPedia Syndication | Tagged , , | Leave a comment

New-AzureVM : BadRequest: The virtual network <foo> does not exist.

Just a quickie. It’s been a long week, and I’ve been trying to get my head around using PowerShell to automate deployments in Azure.

However, I did come across a little glitch in the way that this is supposed to work.

Here’s the syntax I was using:

New-AzureVMConfig -Name $myVMName -InstanceSize $myInstanceSize -ImageName $image.ImageName `
|Add-AzureProvisioningConfig -AdminUserName $myAdminName -Password $myAdminPassword -WindowsDomain -JoinDomain $myDomainFQDN -Domain $myDomainAdminUserDomain -DomainUserName$myDomainAdminUserName -DomainPassword $myDomainAdminPassword -MachineObjectOU $myDomainMachineOU `
|Set-AzureSubnet -SubnetNames $myVLAN `
|Set-AzureStaticVNetIP -IPAddress $myVMIPAddress `
|New-AzureVM -ServiceName $myVMName -Location $myLocation -WaitForBoot -VNetName$myVirtualNetwork

When I got the error message:

VERBOSE: 09:42:11 - Begin Operation: New-AzureVM - Create Deployment with VM TRTestSQLAuto
New-AzureVM : BadRequest: The virtual network SSDevPortal does not exist.
At line:6 char:10
+ |New-AzureVM -ServiceName $myVMName -Location $myLocation -WaitForBoot - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureVM], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewAzureVMCommand

Now, the problem here is that when I look at the virtual network in the Admin Preview Portal, I see that it is there with the right name.

Virtual Networks

So, what to do? Just to check that I’d managed to get the spelling right, and there wasn’t a space or something, I exported the network config and looked at the XML:

Get-AzureVNetConfig -ExportToFile "C:\Users\TRushton\Desktop\VNetConfig.xml"

And there it is, buried in the NetworkConfiguration\VirtualNetworkConfiguration\VirtualNetworkSites area, the VirtualNetworkSite in question:

Network Config XML Excerpt

So, the name in the configuration is not the name that's showing in the Virtual Network window. No wonder it's not working...

Correct the code, and away we go. Job done. But no idea why there's a discrepancy.

Posted in SQLServerPedia Syndication | Tagged , , , | 4 Comments

SQL Server 2012 Silent Install problems

Just been working on a silent install script for SQL 2012, and had a few odd errors.

Unfortunately, I don’t have direct access to the server, just to my notes from the install.

Error: “‘<null or empty string>’ is not a valid value for setting ‘ACTION'”
This appears to be related to a corrupted INI file. Though I couldn’t see what the corruption actually *was*. Putting in a fresh copy of the same file seemed to fix that.

Problem with accessing C:\SQLFULL_ENU\1033_ENU_LP\x64\Setup\sqlsupport_msi\PFiles\SqlServr\110\Setup\qfdhsf2y\e4grzzmx (or, rather, an RTF in a path that looked like this but had different last two directories). Check the edition you have, as it seems to differ from edition to edition. Not sure why the installer would care, though.

Error: “The /UIMode setting cannot be used in conjunction with /Q or /QS.”
Problem in the configuration file. The file was built from a normal installation, and we hadn’t commented out the UIMODE line, which conflicts with the /Q parameter. Oops.

Error: “The configuration file ‘”C:\SQL2012Media\SQLConfv3.ini /ACTION=RUNRULES /RULES=GlobalRules’ does not exist. Specify a valid configuration file”
This was a real pain to figure out. Turns out that the installer line we were using:
Setup.exe /Q /Action=INSTALL /IACCEPT... /CONFIGURATIONFILE="C:\SQL2012Media\SQLConfv3.ini"
should have been
Setup.exe /Q /Action=INSTALL /IACCEPT... /CONFIGURATIONFILE=C:\SQL2012Media\SQLConfv3.ini
Yes. Putting the name of the config file in quotes failed to get this thing running.

And NetFX3 wasn’t there either.

Posted in SQLServerPedia Syndication | Tagged , , | Leave a comment

SQL Server 2012 installation – Error while enabling Windows Feature NetFx3

Just a quickie, as I didn’t have the time to take screenshots.

Installing SQL Server 2012 on a new Windows Server 2012 VM. Part-way through the installation, I got the following error message:

TITLE: Microsoft SQL Server 2012 Service Pack 1 Setup

The following error has occurred:

Error while enabling Windows feature : NetFx3, Error Code : 1726 , Please try enabling Windows feature : NetFx3 from Windows management tools and then run setup again. For more information on how to enable Windows features , see

For help, click:



My first reaction was to try a spot of Powershell to install the feature:

install-windowsfeature NetFx3

Except that, apparently, there’s no such feature. Hmm.

A quick search led me to “The World According to Mitch”, which has a useful post “Installing NetFx3 on Windows Server 2012” that shows this very error (complete with screenshot, if you really need to see it).

The solution that Mitch provides is quite simple: use Deployment Image Servicing and Management to fix.

dism /online /enable-feature /featurename:netfx3 /all

I had left the error on screen while trying the fix, so I was able to continue the installation; of course, the bulk of the features being installed failed, but it’s quick to redo.

Posted in SQLServerPedia Syndication | Tagged , , , , | Leave a comment