Skip to content

Instantly share code, notes, and snippets.

@sn123
Created October 20, 2016 12:32
Show Gist options
  • Save sn123/c849846e10f7389a1b44d26dac76a88f to your computer and use it in GitHub Desktop.
Save sn123/c849846e10f7389a1b44d26dac76a88f to your computer and use it in GitHub Desktop.
Scale up/down Azure Search Replicaset using Runbooks
<#
.SYNOPSIS
Vertically scale (up or down) an Azure SQL Database
.DESCRIPTION
This runbook enables one to vertically scale (up or down) Azure Search ReplicaSet using Azure Automation.
.PARAMETER resourceGroupName
Name of the Azure Search Resource Group
.PARAMETER serviceName
Name of Azure Search Service
.PARAMETER replicaCount
Number of replicas
.NOTES
Author: Sachin N
Last Updated: 10/10/2016
#>
param
(
# Name of the Azure Search resource group
[parameter(Mandatory=$true)]
[string] $resourceGroupName,
# Name of the Azure Search service
[parameter(Mandatory=$true)]
[string] $serviceName,
# Desired Replica count
[parameter(Mandatory=$true)]
[int] $replicaCount
)
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Add-AzureRMAccount -ServicePrincipal -Tenant $Conn.TenantID `
-ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
$resource = Get-AzureRmResource `
-ResourceType "Microsoft.Search/searchServices" `
-ResourceGroupName $resourceGroupName `
-ResourceName $serviceName `
-ApiVersion 2015-08-19
$resource.Properties.ReplicaCount = $replicaCount
$resource | Set-AzureRmResource -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment