Created
July 18, 2017 16:01
-
-
Save RobsonAutomator/82baea407f54db3f8df37cfd41bad3ce to your computer and use it in GitHub Desktop.
Check if all resources required to deploy Sitecore on Azure are supported in Location region
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ############################################################################# | |
# Test-SitecoreAzureDeployment | |
# | |
# AUTHOR: Robert Senktas | |
# BLOG: http://lets-share.senktas.net/2017/07/sitecore-on-azure-test-sitecoreazuredeployment.html | |
# | |
# COMMENT: Check if all resources required to deploy Sitecore on Azure are supported in Location region | |
# This function is part of Sitecore Automation Module | |
# ############################################################################# | |
function Test-SitecoreAzureDeployment | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
# Location name of Azure region | |
[Parameter(Mandatory=$true, | |
ValueFromPipelineByPropertyName=$true, | |
Position=0)] | |
$Location | |
) | |
$resources = @( | |
"Microsoft.Cache/Redis"; | |
"microsoft.insights/alertrules"; | |
"Microsoft.Insights/components"; | |
"Microsoft.Search/searchServices"; | |
"Microsoft.Sql/servers" | |
"Microsoft.Sql/servers/databases"; | |
"Microsoft.Web/serverFarms"; | |
"Microsoft.Web/sites" | |
) | |
$unsupportedResources = $false | |
foreach( $resource in $resources ) | |
{ | |
$splited = $resource -split "/",2 | |
$isSupported = ((Get-AzureRmResourceProvider -ProviderNamespace $($splited[0])).ResourceTypes | Where-Object ResourceTypeName -eq $($splited[1])).Locations.Contains($location) | |
if( $isSupported -eq $false ) | |
{ | |
$unsupportedResources = $true | |
Write-Verbose "Unsupported resource '$resource' in '$location'" | |
} | |
} | |
if( $unsupportedResources -eq $true ) | |
{ | |
Write-Warning "Please check 'https://kb.sitecore.net/articles/617478'" | |
} | |
return -not $unsupportedResources | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment