Forum Discussion

Joe Davies's avatar
Joe Davies
Former Employee
Mar 21, 2017

Setting up a SharePoint Server 2016 farm in Azure?

If you are looking at deploying a SharePoint Server 2016 farm on virtual machines in Azure, see the set of articles at http://aka.ms/sp2016inazure.

 

These articles describe how to create two different dev/test environments, walk you through a planning process to determine the set of Azure infrastructure elements and their settings, and take you step-by-step through the deployment of a high-availability farm using SQL Server AlwaysOn Availability Groups.

 

Let me know what you think.

 

Thanks!

1 Reply

  • Hi Joe Davies

     

    I'm having issues with this code. I had to change StandardLRS to Standard_LRS to stop it crashing out and then on the final step it says "New-AzureRMVM : Object reference not set to an instance of an object." and doesn't create the VM. Please can you advise?

     

    $rgName="<resource group name>"
    # Get the location
    $locName=(Get-AzureRmResourceGroup -Name $rgName).Location
    # Create an availability set for domain controller virtual machines
    New-AzureRMAvailabilitySet -ResourceGroupName $rgName -Name dcAvailabilitySet -Location $locName -Sku Aligned -PlatformUpdateDomainCount 5 -PlatformFaultDomainCount 2
    # Create the adVM virtual machine
    $vmName="adVM"
    $vmSize="Standard_D1_v2"
    $vnet=Get-AzureRMVirtualNetwork -Name SP2016Vnet -ResourceGroupName $rgName
    $pip = New-AzureRMPublicIpAddress -Name ($vmName + "-PIP") -ResourceGroupName $rgName -Location $locName -AllocationMethod Dynamic
    $nic = New-AzureRMNetworkInterface -Name ($vmName + "-NIC") -ResourceGroupName $rgName -Location $locName -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id -PrivateIpAddress 10.0.0.4
    $avSet=Get-AzureRMAvailabilitySet -Name dcAvailabilitySet -ResourceGroupName $rgName
    $vm=New-AzureRMVMConfig -VMName $vmName -VMSize $vmSize -AvailabilitySetId $avSet.Id
    $vm=Set-AzureRmVMOSDisk -VM $vm -Name ($vmName +"-OS") -DiskSizeInGB 128 -CreateOption FromImage -StorageAccountType "StandardLRS"
    $diskConfig=New-AzureRmDiskConfig -AccountType "StandardLRS" -Location $locName -CreateOption Empty -DiskSizeGB 20
    $dataDisk1=New-AzureRmDisk -DiskName ($vmName + "-DataDisk1") -Disk $diskConfig -ResourceGroupName $rgName
    $vm=Add-AzureRmVMDataDisk -VM $vm -Name ($vmName + "-DataDisk1") -CreateOption Attach -ManagedDiskId $dataDisk1.Id -Lun 1
    $cred=Get-Credential -Message "Type the name and password of the local administrator account for adVM."
    $vm=Set-AzureRMVMOperatingSystem -VM $vm -Windows -ComputerName adVM -Credential $cred -ProvisionVMAgent -EnableAutoUpdate
    $vm=Set-AzureRMVMSourceImage -VM $vm -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2012-R2-Datacenter -Version "latest"
    $vm=Add-AzureRMVMNetworkInterface -VM $vm -Id $nic.Id
    New-AzureRMVM -ResourceGroupName $rgName -Location $locName -VM $vm

Resources