Create WSFC Cluster for AlwaysOn Availability Groups in Windows Azure VM

(Updated on 9/13/2013)This script is used to aid the configuration of SQL Server 2012 AlwaysOn Availability Groups in Windows Azure VMs. It creates a functioning WSFC cluster on which you can configure one or more availability groups. It is not needed for on-premise SQL Server

 
 
 
 
 
5 Star
(7)
4,601 times
Add to favorites
Databases
8/29/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • The cluster fails to start
    4 Posts | Last post December 18, 2018
    • I was able to execute the script without errors and it created the cluster. Unfortunately the cluster fails to start. From Cluster Events:
      
      "Cluster network name resource 'Cluster Name' cannot be brought online. Ensure that the network adapters for dependent IP address resources have access to at least one DNS server. Alternatively, enable NetBIOS for dependent IP addresses."
      
      There's also the following error event:
      Cluster IP address resource 'Cluster IP Address' cannot be brought online because a duplicate IP address '10.4.3.5' was detected on the network.  Please ensure all IP addresses are unique.
      
      Any recommendations?
      
    • That's curious. If the script executed without errors, you should not be able to see the error regarding the cluster IP address because it has already been deleted by the script. If the script were not able to delete the cluster IP address in the first place, then you should have seen an error.
      
      When you say that the cluster failed to start, can you elaborate? The cluster should be online already for most of the script to execute without errors. Did you try to restart the cluster after running the script? Did the cluster name alone fail or did the whole cluster actually fail (cluster service stopped)?
    • MikaelAd, I'd like to clarify my earlier answer that for the cluster name to be offline does not affect AlwaysOn Availability Groups in the cluster, so if that is the case for you, then you're good to go; but if the whole cluster fails (cluster service stopped), then you have a problem. The cluster name cannot be online since there's no IP address to map the name to anymore after you run the script.
    • this works well. i was looking for windows 2016 custer & could get it with below code. 
      # EG to run the script .\ClusterBuild.ps1 -Clu 'abcd' -ClusterIP '172.31.13.190' -Node1 'SAMnode01.cislab.com' -Node2 'Samnode02.cislab.com' -WitnessShare '\\sqlnode4.Zensarlab.com\testshare'
      
      Save below in ClusterBuild.ps1
      
      param
      (
        $Clu,
        $ClusterIP,
        $Node1,
        $Node2,
        $WitnessShare
      )
      
      #Windows Failover Cluster
      Write-Host "Admin rights are required to enumerate information." 	-ForegroundColor Green
      
      New-Cluster -Name $Clu -StaticAddress $ClusterIP -Node $Node1,$Node2 -NoStorage
      Set-ClusterQuorum -NodeAndFileShareMajority $WitnessShare
      
  • Why does this script create cluster disks and destroys storage pools?
    1 Posts | Last post January 20, 2016
    • We have tried to run this script. When it was finished, it destroyed my storage pool (which was a striped set of 4x VHD disks)
      
      Any clue?
  • Can this be used for SQL Server 2014 AlwaysOn AGs?
    1 Posts | Last post August 13, 2015
    • This is the most recent PS for creating WSFC. This has been written with SQL 2012 AlwaysOn AGs in mind. Can I use this for the WSFC cluster for a SQL 2014 AlwaysOn AGs? What about upcoming SQL 2016?
  • Why would you set the Cluster code address to 169.254.1.1
    3 Posts | Last post September 23, 2014
    • hi guys, I have a question:
      
      Why would you set the cluster code address to 169.254.1.1? And I cannot connect this address(Ping). 
      
      
      Thanks
      -Jinran
    • I get it, this IP is the same as the Cloud Service IP Address, but I don't know how to set the IP Resource for AG Listener? I can set a static IP in the VM's sub-net, but it cannot be connection.
      
      Do you have any ideas
      
      Thanks
      -Jinran
      
    • The 169.254.1.1 address has nothing to do with the cloud service IP address. It's a link-local address that you must set your cluster so that the cluster name can come online successfully and stay online. See http://msdn.microsoft.com/en-us/library/azure/jj870962.aspx, and go to the "WSFC cluster behavior in Azure networking" section.
      
      The AG listener is a totally different animal from this post/script. I also have a script for that at http://gallery.technet.microsoft.com/scriptcenter/Create-Availability-Group-fff94cd5 (for a cloud-only AG - there's another link for hybrid IT)
  • Getting an error Adding nodes
    2 Posts | Last post October 14, 2013
    • I am getting the following error:
      
      Add-ClusterNode : An error occurred while adding node 'qamedasql2' to cluster 'QACluster'.
          The cluster node is not reachable
      At line:1 char:16
      + add-clusternode <<<<  $server2
          + CategoryInfo          : NotSpecified: (:) [Add-ClusterNode], ClusterCmdletException
          + FullyQualifiedErrorId : Add-ClusterNode,Microsoft.FailoverClusters.PowerShell.AddClusterNodeCommand
      
      Any ideas on what the problem is?
      
      Lee
    • Lee, I've seen this error when the is pending a restart.
  • Can we get a version of the script without the "Cluster Res" line?
    2 Posts | Last post March 27, 2013
    • When I run the script I get an error since the cluster.exe isn't installed. I can't find a way to install it in Windows 2012 and it's supposed to be replaced anyway?
      
      cluster res $NameOfIPv4Resource /priv enabledhcp=0 overrideaddressmatch=1 address=169.254.1.1 subnetmask=255.255.0.0 
      
      I note that MikaelAd had this issue back in December but I don't know how to map the "cluster res" command into the equivalent powershell command.
      
      Some help here would be much appreciated!
    • You may not have the necessary Windows features installed. Try running the following command. You will see this same recommendation if you use the new version of the script (updated 3/22).
      
      Add-WindowsFeature 'Failover-Clustering', 'RSAT-Clustering-PowerShell', 'RSAT-Clustering-CmdInterface'
  • I need help.
    4 Posts | Last post March 15, 2013
    • thank you for script Cephas Lin.
      But when i do script on powershell. error happen. 
      I don't know how can fix. 
      please give a tip please. 
      my email : ilovenamhoon@hotmail.com
      --------------------------------------------------------------
      PS D:\> Set-ExecutionPolicy -Execution RemoteSigned -Force .\CreateAzureFailoverCluster.ps1 -ClusterName "MyCluster" -Cl
      usterNodes "maroosql1", "maroosql2"
      Set-ExecutionPolicy : Cannot bind parameter 'Scope'. Cannot convert value ".\CreateAzureFailoverCluster.ps1" to type
      "Microsoft.PowerShell.ExecutionPolicyScope". Error: "Unable to match the identifier name
      .\CreateAzureFailoverCluster.ps1 to a valid enumerator name.  Specify one of the following enumerator names and try
      again: Process, CurrentUser, LocalMachine, UserPolicy, MachinePolicy"
      At line:1 char:52
      + Set-ExecutionPolicy -Execution RemoteSigned -Force .\CreateAzureFailoverCluster. ...
      +                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Set-ExecutionPolicy], ParameterBindingException
          + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
    • Hi namhoon. Looks like you actually execute two commands as one command and PowerShell thinks that .\CreateAzureFailoverCluster.ps1 is an input to Set-ExecutionPolicy. You should execute the two commands one at a time.
      
      By the way, by reading your issue I also discovered a mistake: The Set-ExecutionPolicy command needs to have -Execution parameter set to Unrestricted. The script is not remote-signed so that flag won't work. I've updated the post now.
    • Hi We also tried the script above and it didnt work and threw the exact same error. We had run the two steps Set-ExecutionPolicy and  .\CreateAzureFailoverCluster.ps1  separately too but still the error is the same :-
      
      An error occurred while attempting to take the resource 'Cluster IP Address' offline.
          The group or resource is not in the correct state to perform the requested operation
      At H:\CreateAzureFailoverCluster.ps1:103 char:23
      
      Can you please help.
    • You might want to try to perform this step in the UI instead then. The script might be executed too quickly so that the cluster has not settled into the right state before you could take the cluster IP address offline. Or, maybe for one reason or another the cluster IP address is already offline. You'll be able to see what's happening better in the UI. In the Failover Cluster Manager, right-click the cluster IP address resource and select "Bring this resource offline" and see what happens.
  • Get-Cluster : A positional parameter cannot be found that accepts argument 'Cluster IP Address'.
    3 Posts | Last post February 07, 2013
    • I'm encountering an error when running the scripts. Here's the log:
      
      ***
      Making sure that there is no cluster currently running on the current node
      Trying to create a one node cluster on the current machine
      
      Name
      ----
      FilesShareCluster
      Verify that cluster is present after creation
      Bring offline the cluster name resource
      Cluster Name
      Get all IP addresses associated with cluster group
      Found 1 IP addresses
      Bringing all IPs offline
      Cluster IP Address
      Get the first IPv4 resource
      Removing all IPs except one IPv4 resource
      Setting the cluster IP address to a link local address
      Get-Cluster : A positional parameter cannot be found that accepts argument 'Cluster IP Address'.
      At C:\createazurefailovercluster.ps1:117 char:1
      + cluster res $NameOfIPv4Resource /priv enabledhcp=0 overrideaddressmatch=1 addres ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-Cluster], ParameterBindingException
          + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.FailoverClusters.PowerShell.GetClusterCommand
      
      ***
      Any ideas?
    • The problem occurred because the server didn't have "Failover Cluster Command Interface" installed. Because of this the call to "cluster.exe" actually executed "Get-Cluster".
    • Hi Mikael Could you resolve the problem ?
      I am also facing the same error :-
      
      Verify that cluster is present after creation
      Bring offline the cluster name resource
      Cluster Name
      Get all IP associated with cluster group
      Found 1 IP addresses
      Bringing all IPs offline
      Stop-ClusterResource : An error occurred while attempting to take the resource 'Cluster IP Address' offline.
          The group or resource is not in the correct state to perform the requested operation
      At H:\CreateAzureFailoverCluster.ps1:103 char:23
      + $AllClusterGroupIPs | Stop-ClusterResource
      +                       ~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [Stop-ClusterResource], ClusterCmdletException
          + FullyQualifiedErrorId : InvalidState,Microsoft.FailoverClusters.PowerShell.StopClusterResourceCommand