Sync an Azure Web Site using Continuous Deployment with PowerShell

With the recent release of WordPress 4.5.2 and Project Nami 1.3.3, I was looking to script the sync of this web site as it’s using Azure continuous deployment and connected to the Project Nami source on GitHub. It took longer to find the solution that run it. Here’s the Azure PowerShell.

Import-Module AzureRM.Websites
$MyResourceGroup = 'myresourcegroupname'
$MyResourceName = 'myresourcename'
Invoke-AzureRmResourceAction -ResourceGroupName $MyResourceGroup -ResourceType Microsoft.Web/sites -ResourceName $MyResourceName -Action sync -ApiVersion 2015-08-01 -Force -Verbose

Plugins and Multi-site Testing

Spent some time today bringing this site up to the latest WordPress 4.5.1 – easy deployment sync in Azure for this Project Nami based installation.

I also tried a few plugins unsuccessfully.

  • UpdraftPlus – backups site files, themes, contents just fine (to Dropbox), but failed on backing up the database (can understand this).
  • Wordfence – couldn’t get it to automatically load its free API. Word is to basically this is not even supported on Windows/IIS.

The next work entailed moving to a multi-site WordPress setup.

Steps (Webmatrix makes this easy):

  1. Edit your wp-config.php and add:

    /* Multisite */
    define('MULTISITE', true);
  1. Log back in to your site and hit the add a Network wizard.

If  you encounter an issue where your WP states you must use sub-domains (not possible on a free Azure site) you can use this great trick (assuming you’re OK with the possible issues):

Add this to the functions.php of your current theme:

add_filter( 'allow_subdirectory_install',
	create_function( '', 'return true;' )
  1. Refresh your Network wizard page and you’ll get the option to use sub-directories.
  2. Complete the wizard and follow its remaining steps.