Skip to content

Instantly share code, notes, and snippets.

View andreaswasita's full-sized avatar

Andreas Wasita andreaswasita

View GitHub Profile
Set-AzureVNetGatewayKey -VNetName USVNET -LocalNetworkSiteName SEVNET -SharedKey mypresharedkeysevnet9876
Set-AzureVNetGatewayKey -VNetName SEVNET -LocalNetworkSiteName UVNET -SharedKey mypresharedkeysevnet9876
cls
Import-module Azure
$subscription = Read-Host -Prompt 'Microsoft Azure Subscription:'
$storage = Read-Host -Prompt 'Storage Account Name:'
Set-azuresubscription -SubscriptionName $subscription -CurrentStorageAccountName $storage
#Get the latest image ; Windows Server 2012 Datacenter or mykloud2012datacenterimage
$svc="AZSEDB"
$ilb="SQLILB"
$subnet="Azure-BackEnd"
$IP="10.0.1.100"
Add-AzureInternalLoadBalancer -ServiceName $svc -InternalLoadBalancerName $ilb –SubnetName $subnet –StaticVNetIPAddress $IP
$svc="AZSEDB"
$prot="tcp"
$locport=1433
$pubport=1433
$ilb="SQLILB"
$vmname="AZSEDB001"
$epname="LOB1"
Get-AzureVM –ServiceName $svc –Name $vmname | Add-AzureEndpoint -Name $epname -Protocol $prot -LocalPort $locport -PublicPort $pubport –DefaultProbe -InternalLoadBalancerName $ilb | Update-AzureVM
$svc="azsedb"
$ilb="sqlilb"
$subnet="Azure-BackEnd"
$IP="10.0.1.100"
Add-AzureInternalLoadBalancer –ServiceName $svc -InternalLoadBalancerName $ilb –SubnetName $subnet –StaticVNetIPAddress $IP
$prot="tcp"
$locport=1433
$pubport=1433
import-module failoverclusters
move-clustergroup "Cluster Group" -node azusdb001
cls
# Define variables
$AGNodes = "azsedb001","azsedb002" # SQL AAG VMs in SEVNET
$ServiceName = "azsedb" # SQL VMs Cloud Service in SEVNET
$EndpointName = "SQLAAG" # name of the endpoint
$EndpointPort = "1433" # public port to use for the endpoint
# Configure a load balanced endpoint for each node in $AGNodes, with direct server return enabled
ForEach ($node in $AGNodes)
{
# Define variables
$ClusterNetworkName = "Cluster Network 1" # the cluster network name
$IPResourceName = "IP Address 10.0.1.0" # the IP Address resource name
$CloudServiceIP = "23.100.xxx.xxx" # IP address of your cloud service
Import-Module FailoverClusters
Get-ClusterResource $IPResourceName | Set-ClusterParameter -Multiple @{"Address"="$CloudServiceIP";"ProbePort"="59999";SubnetMask="255.255.255.128";"Network"="$ClusterNetworkName";"OverrideAddressMatch"=1;"EnableDhcp"=0}
# Define variables
$ClusterNetworkName = "Cluster Network 2" # the cluster network name
$IPResourceName = "IP Address 192.168.1.0" # the IP Address resource name
azure vm create KloudHAProxy001 -o vmdepot-151-1-8 -l "Southeast Asia" kloudadmin [PASSWORDHERE] [--ssh] [other_options]
$service= "AzureVMAntiMalware"
$name = "MyAzureVM01"
# Get the Azure VM
$vm = Get-AzureVM –ServiceName $service –Name $name
# Add Microsoft Antimalware Agent to Azure VM
Set-AzureVMExtension -Publisher Microsoft.Azure.Security -ExtensionName IaaSAntimalware -Version 1.* -VM $vm.VM
# Update the VM which will install the Antimalware Agent