-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
959 additions
and
20 deletions.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
AzurePreBuiltEnvironmentSQLServer_HA_DR/10_Add2NodesToGeoCluster.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#Run the following on each sql server at the West Central US | ||
Add-Computer -DomainName Azuring.local -Credential pcondeca | ||
Restart-Computer -force | ||
|
||
#install failover clustering and File share role | ||
Install-WindowsFeature –Name Failover-Clustering,File-Services –IncludeManagementTools | ||
|
||
Get-Cluster WestEuropeSQLCluster01 | Add-ClusterNode SQL03 | ||
|
||
Get-Cluster WestEuropeSQLCluster01 | Add-ClusterNode SQL04 | ||
#Enable S2D on the cluster | ||
Enable-ClusterS2D | ||
|
||
#View Disks | ||
Get-StorageSubsystem Clus* | Get-PhysicalDisk | ||
|
||
#Create Storage Pool | ||
New-Volume -StoragePoolFriendlyName S2D* -FriendlyName DATA01 -FileSystem CSVFS_NTFS -AllocationUnitSize 65536 -Size 80GB -ProvisioningType Fixed -ResiliencySettingName Mirror | ||
New-Volume -StoragePoolFriendlyName S2D* -FriendlyName LOG01 -FileSystem CSVFS_NTFS -AllocationUnitSize 65536 -Size 40GB -ProvisioningType Fixed -ResiliencySettingName Mirror | ||
New-Volume -StoragePoolFriendlyName S2D* -FriendlyName TEMPDB01 -FileSystem CSVFS_NTFS -AllocationUnitSize 65536 -Size 40GB -ProvisioningType Fixed -ResiliencySettingName Mirror | ||
New-Volume -StoragePoolFriendlyName S2D* -FriendlyName BACKUP01 -FileSystem CSVFS_NTFS -AllocationUnitSize 65536 -Size 40GB -ProvisioningType Fixed -ResiliencySettingName Mirror | ||
|
||
#At just need to run the cluster validation, and go! |
23 changes: 15 additions & 8 deletions
23
AzurePreBuiltEnvironmentSQLServer_HA_DR/1_CreateAvailabilitySets.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
#Starting in Ireland, lets create our Availability sets. | ||
# In a nutshell: to avoid having a single point of failure on network/rack/software updates | ||
# A numero de FaulDomains difere de datacenter para datacenter... | ||
#latest version | ||
Install-Module AzureRM.Compute -RequiredVersion 2.6.0 | ||
#WestEurope | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure01 -Name asDomainControllers01 -Location "westeurope" -managed -PlatformFaultDomainCount 3 | ||
|
||
#Ireland DCs | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure01 -Name asDomainControllers01 -Location "westeurope" | ||
|
||
#Amsterdam DCs | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure02 -Name asDomainControllers02 -Location "WestCentralUs" | ||
#WestCentralUs | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure02 -Name asDomainControllers02 -Location "WestCentralUs" -managed -PlatformFaultDomainCount 2 | ||
|
||
#Ireland SQLServer | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure01 -Name asSQLServer01 -Location "westeurope" | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure01 -Name asSQLServer01 -Location "westeurope" -managed -PlatformFaultDomainCount 3 | ||
|
||
#Amsterdam SQLServer | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure02 -Name asSQLServer02 -Location "WestCentralUs" | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure02 -Name asSQLServer02 -Location "WestCentralUs" -managed -PlatformFaultDomainCount 2 | ||
|
||
#WestEurope | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure01 -Name asStorage01 -Location "westeurope" -managed -PlatformFaultDomainCount 3 | ||
|
||
#WestCentralUs | ||
New-AzureRmAvailabilitySet -ResourceGroupName rgInfrastructure02 -Name asStorage02 -Location "WestCentralUs" -managed -PlatformFaultDomainCount 2 | ||
|
||
Get-AzureRmAvailabilitySet rgInfrastructure01 |
11 changes: 0 additions & 11 deletions
11
AzurePreBuiltEnvironmentSQLServer_HA_DR/2_CreateSubnets.ps1
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
AzurePreBuiltEnvironmentSQLServer_HA_DR/2_CreateVnetsAndSubnets.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#Create The Virtual Network in Dublin | ||
$vnetName= "VnetProductionWestEurope" | ||
|
||
$Vnet = New-AzureRmVirtualNetwork -ResourceGroupName rgInfrastructure01 -Name $vnetName -AddressPrefix 192.168.0.0/16 -Location westeurope | ||
|
||
|
||
#Create 2 different Subnets in Dublin to segment the workloads, one for the DCs and another one for SQL Server | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetDCWestEurope -AddressPrefix 192.168.111.0/24 | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetSQLWestEurope -AddressPrefix 192.168.112.0/24 | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetSQLBackendWestEurope -AddressPrefix 192.168.113.0/24 | ||
#must have this name for the VPN GatewaySubnet | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name GatewaySubnet -AddressPrefix 192.168.114.0/24 | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetStorage -AddressPrefix 192.168.115.0/24 | ||
|
||
|
||
# Set the goal state for the VNET | ||
Set-AzureRmVirtualNetwork -VirtualNetwork $vnet | ||
|
||
###### | ||
#Similar Architecture in West Central US | ||
###### | ||
|
||
#Create The Virtual Network in WestCentralUS | ||
$vnetName= "VnetProductionWestCentralUS" | ||
|
||
|
||
$Vnet = New-AzureRmVirtualNetwork -ResourceGroupName rgInfrastructure02 -Name $vnetName -AddressPrefix 10.10.0.0/16 -Location WestCentralUS | ||
|
||
|
||
#Create 2 different Subnets in Dublin to segment the workloads, one for the DCs and another one for SQL Server | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetDCWestCentralUs -AddressPrefix 10.10.111.0/24 | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetSQLWestCentralUs -AddressPrefix 10.10.112.0/24 | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetSQLBackendWestCentralUs -AddressPrefix 10.10.113.0/24 | ||
#must have this name for the VPN GatewaySubnet | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name GatewaySubnet -AddressPrefix 10.10.114.0/24 | ||
Add-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name subnetStorage -AddressPrefix 10.10.115.0/24 | ||
|
||
|
||
# Set the goal state for the VNET | ||
Set-AzureRmVirtualNetwork -VirtualNetwork $vnet |
11 changes: 11 additions & 0 deletions
11
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_10_CreateSQLServerFCICluster.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#Run the following on each sql server | ||
Add-Computer -DomainName Azuring.local -Credential pcondeca | ||
Restart-Computer -force | ||
|
||
#install failover clustering and File share role | ||
Install-WindowsFeature –Name Failover-Clustering –IncludeManagementTools | ||
|
||
#Create Cluster | ||
New-Cluster -Name WWSQLCluster01 -Node SQL01,SQL02 -StaticAddress 192.168.112.14 -NoStorage | ||
|
||
#Cloud witness goes here |
35 changes: 35 additions & 0 deletions
35
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_1_CreateWestEuropeDC01.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#Create VMs | ||
|
||
#Administrative Account to be locally created on the servers: | ||
$cred = Get-Credential | ||
|
||
$rgName = 'rgInfrastructure01' | ||
$location = 'WestEurope' | ||
$asName='asDomainControllers01' | ||
$vmSize ="Standard_A0" | ||
$machineName="DC01" | ||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetDCWestEurope" | ||
$ipAddress ="192.168.111.10" | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
#CreateVM Windows | ||
$vm = New-AzureRmVMConfig -VMName $machineName -VMSize $vmSize -AvailabilitySetId $AvailabilitySet | ||
$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $machineName ` | ||
-Credential $cred -ProvisionVMAgent -EnableAutoUpdate | ||
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer ` | ||
-Offer WindowsServer -Skus 2016-Datacenter -Version "latest" | ||
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id | ||
|
||
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm |
35 changes: 35 additions & 0 deletions
35
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_2_CreateWestEuropeDC02.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#Create VMs | ||
|
||
#Administrative Account to be locally created on the servers: | ||
$cred = Get-Credential | ||
|
||
$rgName = 'rgInfrastructure01' | ||
$location = 'WestEurope' | ||
$asName='asDomainControllers01' | ||
$vmSize ="Standard_A0" | ||
$machineName="DC02" | ||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetDCWestEurope" | ||
$ipAddress ="192.168.111.11" | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
#CreateVM Windows | ||
$vm = New-AzureRmVMConfig -VMName $machineName -VMSize $vmSize -AvailabilitySetId $AvailabilitySet | ||
$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $machineName ` | ||
-Credential $cred -ProvisionVMAgent -EnableAutoUpdate | ||
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer ` | ||
-Offer WindowsServer -Skus 2016-Datacenter -Version "latest" | ||
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id | ||
|
||
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm |
35 changes: 35 additions & 0 deletions
35
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_3_CreateWestEuropeSQL01.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#Create VMs | ||
|
||
#Administrative Account to be locally created on the servers: | ||
$cred = Get-Credential | ||
|
||
$rgName = 'rgInfrastructure01' | ||
$location = 'WestEurope' | ||
$asName='asSQLServer01' | ||
$vmSize ="Standard_A0" | ||
$machineName="SQL01" | ||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetSQLWestEurope" | ||
$ipAddress ="192.168.112.10" | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
#CreateVM Windows | ||
$vm = New-AzureRmVMConfig -VMName $machineName -VMSize $vmSize -AvailabilitySetId $AvailabilitySet | ||
$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $machineName ` | ||
-Credential $cred -ProvisionVMAgent -EnableAutoUpdate | ||
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer ` | ||
-Offer WindowsServer -Skus 2016-Datacenter -Version "latest" | ||
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id | ||
|
||
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm |
35 changes: 35 additions & 0 deletions
35
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_4_CreateWestEuropeSQL02.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#Create VMs | ||
|
||
#Administrative Account to be locally created on the servers: | ||
$cred = Get-Credential | ||
|
||
$rgName = 'rgInfrastructure01' | ||
$location = 'WestEurope' | ||
$asName='asSQLServer01' | ||
$vmSize ="Standard_A0" | ||
$machineName="SQL02" | ||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetSQLWestEurope" | ||
$ipAddress ="192.168.112.11" | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
#CreateVM Windows | ||
$vm = New-AzureRmVMConfig -VMName $machineName -VMSize $vmSize -AvailabilitySetId $AvailabilitySet | ||
$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $machineName ` | ||
-Credential $cred -ProvisionVMAgent -EnableAutoUpdate | ||
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer ` | ||
-Offer WindowsServer -Skus 2016-Datacenter -Version "latest" | ||
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id | ||
|
||
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm |
86 changes: 86 additions & 0 deletions
86
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_5_AddBackedNICsForSQLServerWestEurope.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
$machineName="SQL01" | ||
$rgName = 'rgInfrastructure01' | ||
$asName='asSQLServer01' | ||
$location = 'WestEurope' | ||
|
||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetSQLBackedWestEurope" | ||
$ipAddress ="192.168.113.11" | ||
|
||
#VM WILL BE STOPPED | ||
Stop-AzureRmVM -Name $machineName -ResourceGroupName $rgName | ||
|
||
$vm = Get-AzureRmVm -Name $machineName -ResourceGroupName $rgName | ||
|
||
# Find out all the NICs on the VM and find which one is primary | ||
$vm.NetworkProfile.NetworkInterfaces | ||
|
||
# Set NIC 0 to be primary | ||
$vm.NetworkProfile.NetworkInterfaces[0].Primary = $true | ||
|
||
# Update the VM state in Azure | ||
Update-AzureRmVM -VM $vm -ResourceGroupName $rgName | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
|
||
Get-AzureRmNetworkInterface | Where-Object{$_ -like "acked"} | ||
|
||
$VirtualMachine = Get-AzureRmVM -ResourceGroupName $rgName -Name $machineName | ||
Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id "/subscriptions/e7c49cc2-f1dd-458b-b592-a9f941b5c9a5/resourceGroups/rgInfrastructure01/providers/Microsoft.Network/networkInterfaces/NicsubnetSQLBackedWestEuropeSQL01" | ||
Update-AzureRmVM -ResourceGroupName $rgName -VM $VirtualMachine | ||
|
||
|
||
### SQL02 | ||
$machineName="SQL02" | ||
$rgName = 'rgInfrastructure01' | ||
$asName='asSQLServer01' | ||
$location = 'WestEurope' | ||
|
||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetSQLBackedWestEurope" | ||
$ipAddress ="192.168.113.12" | ||
|
||
#VM WILL BE STOPPED | ||
Stop-AzureRmVM -Name $machineName -ResourceGroupName $rgName | ||
|
||
$vm = Get-AzureRmVm -Name $machineName -ResourceGroupName $rgName | ||
|
||
# Find out all the NICs on the VM and find which one is primary | ||
$vm.NetworkProfile.NetworkInterfaces | ||
|
||
# Set NIC 0 to be primary | ||
$vm.NetworkProfile.NetworkInterfaces[0].Primary = $true | ||
|
||
# Update the VM state in Azure | ||
Update-AzureRmVM -VM $vm -ResourceGroupName $rgName | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
|
||
Get-AzureRmNetworkInterface | Where-Object{$_ -like "acked"} | ||
|
||
$VirtualMachine = Get-AzureRmVM -ResourceGroupName $rgName -Name $machineName | ||
Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id "/subscriptions/e7c49cc2-f1dd-458b-b592-a9f941b5c9a5/resourceGroups/rgInfrastructure01/providers/Microsoft.Network/networkInterfaces/NicsubnetSQLBackedWestEuropeSQL02" | ||
Update-AzureRmVM -ResourceGroupName $rgName -VM $VirtualMachine | ||
|
35 changes: 35 additions & 0 deletions
35
AzurePreBuiltEnvironmentSQLServer_HA_DR/3_6_CreateWestEuropeStorage01.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#Create VMs | ||
|
||
#Administrative Account to be locally created on the servers: | ||
$cred = Get-Credential | ||
|
||
$rgName = 'rgInfrastructure01' | ||
$location = 'WestEurope' | ||
$asName='asStorage01' | ||
$vmSize ="Standard_A0" | ||
$machineName="Storage01" | ||
$vnetName= "VnetProductionWestEurope" | ||
$subnetName="subnetStorage" | ||
$ipAddress ="192.168.115.21" | ||
|
||
|
||
$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName | ||
$AvailabilitySet = $AvailabilitySet.Id | Where-Object {$_ -like "*$asName*"} | ||
|
||
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgName -Name $vnetName | ||
$subnet = $vnet.Subnets.Id | Where-Object{$_ -like "*$subnetName*"} | ||
|
||
$nicName = "Nic"+$subnetName+$MachineName | ||
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName ` | ||
-Location $location -SubnetId $subnet ` | ||
-PrivateIpAddress $ipAddress | ||
|
||
#CreateVM Windows | ||
$vm = New-AzureRmVMConfig -VMName $machineName -VMSize $vmSize -AvailabilitySetId $AvailabilitySet | ||
$vm = Set-AzureRmVMOperatingSystem -VM $vm -Windows -ComputerName $machineName ` | ||
-Credential $cred -ProvisionVMAgent -EnableAutoUpdate | ||
$vm = Set-AzureRmVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer ` | ||
-Offer WindowsServer -Skus 2016-Datacenter -Version "latest" | ||
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id | ||
|
||
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm |
Oops, something went wrong.