Yvand/AzureRM-Templates

Error using terraform

Closed this issue · 6 comments

Using Sharepoint terraform, the following error has occurred:

azurerm_virtual_machine_extension.VM-DC-DSC: Creation complete after 16m12s [id=/subscriptions/<subid>/resourceGroups/Sharepoint/providers/Microsoft.Compute/virtualMachines/VM-DC/extensions/VM-DC-DSC]

Error: Error running command 'ping 127.0.0.1 -n 6 > nul': exit status 64. Output: usage: ping [-AaDdfnoQqRrv] [-c count] [-G sweepmaxsize]
            [-g sweepminsize] [-h sweepincrsize] [-i wait]
            [-l preload] [-M mask | time] [-m ttl] [-p pattern]
            [-S src_addr] [-s packetsize] [-t timeout][-W waittime]
            [-z tos] host
       ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait]
            [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr]
            [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
            [-z tos] mcast-group
Apple specific options (to be specified before mcast-group or host like all options)
            -b boundif           # bind the socket to the interface
            -k traffic_class     # set traffic class socket option
            -K net_service_type  # set traffic class socket options
            -apple-connect       # call connect(2) in the socket
            -apple-time          # display current time


Yvand commented

I didn't update the template for a while and it was outdated on many aspects.
I couldn't repro your specific error, but the ping script was a workaround to a bug in azurerm that was fixed some time ago.
I updated the template and fixed most of the problems. There is still some work to do (FE VM cannot be added yet and some resources are missing), but it should deploy successfully

Can this be used to create a Sharepoint 2016, or is it 2019 only?

Yvand commented

Yes, it can create SharePoint 2019/2016/2013 farms, you just need to set parameter sharePointVersion to 2016 in your tfvars file

Thank you. I tried this again today setting sharePointVersion to 2016 as you said and received the below error. The VMs have been deployed and seem to be working correctly.

This has installed Sharepoint 2019

Error: Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'VM-SP-DSC'. Error message: \"DSC Configuration 'ConfigureSPVM' completed with error(s). Following are the first few: An update conflict has occurred, and you must re-try this action. The object SPClaimEncodingManager Name=ClaimEncodingManager was updated by CONTOSO\\spfarm, in the OWSTIMER (5124) process, on machine SP.  View the tracing log for more information about the conflict. PowerShell DSC resource MSFT_SPTrustedIdentityTokenIssuer  failed to execute Set-TargetResource functionality with error message: SharePoint failed to create the SPTrustedIdentityTokenIssuer.  The field with Id {0a9ec8f0-0340-4e24-9b35-ca86a6ded5ab} defined in feature {8b2c6bcb-c47f-4f17-8127-f8eae47a44dd} was found in the current site collection or in a subsite.\"\r\n\r\nMore information on troubleshooting is available at https://aka.ms/VMExtensionDSCWindowsTroubleshoot "

  on SharePoint-ADFS.tf line 403, in resource "azurerm_virtual_machine_extension" "VM-SP-DSC":
 403: resource "azurerm_virtual_machine_extension" "VM-SP-DSC" {
Yvand commented

Yes, I just noticed this issue, it's because the tfvars file must also repeat the whole variable vmSP, including vmImageSKU:

sharePointVersion = 2016
vmSP = {
    vmName             = "SP"
    vmSize             = "Standard_E2ds_v4"
    vmImagePublisher   = "MicrosoftSharePoint"
    vmImageOffer       = "MicrosoftSharePointServer"
    vmImageSKU         = "sp2016"
    storageAccountType = "Standard_LRS"
}

This is working now thanks!