#Requires -Version 3.0 Param( [string] $ResourceGroupLocation = 'northeurope', [string] $ResourceGroupName = 'PuzzelOffice365Connector', [string] $IntegrationAccountName = 'PuzzelConnectorIntegrationAccount', [string] $ConnectorBaseName = 'PuzzelConnectorBase', [string] $ConnectorTriggeredName = 'PuzzelConnectorEmailTriggered', [string] $ConnectorManualName = 'PuzzelConnectorManualRun', [string] [Parameter(Mandatory=$true)] $ClientID, [string] [Parameter(Mandatory=$true)] $Secret, [string] [Parameter(Mandatory=$true)] $TenantID, [string] [Parameter(Mandatory=$true)] $Email, [string] [Parameter(Mandatory=$true)] $PuzzelClientId, [string] [Parameter(Mandatory=$true)] $PuzzelPassword, [string] [Parameter(Mandatory=$true)] $PuzzelUser, [string] [Parameter(Mandatory=$true)] $PuzzelAccessPoint, [string] [Parameter(Mandatory=$true)] $OnErrorEmail, [string] $TemplateFileUrl = 'https://puzzelconnected.azurewebsites.net/office365/template.json' ) # Create the ResourceGroup only when it doesn't already exist if ($null -eq (Get-AzResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -ErrorAction SilentlyContinue)) { write-host "Creating ResourceGroup $ResourceGroupName." New-AzResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop }else{ write-host "ResourceGroup $ResourceGroupName exists." } $ParametersObj = @{ ConnectorBaseName = "$ConnectorBaseName" ConnectorTriggeredName = "$ConnectorTriggeredName" ConnectorManualName = "$ConnectorManualName" IntegrationAccountName ="$IntegrationAccountName" ClientID ="$ClientID" Secret ="$Secret" TenantID ="$TenantID" Email ="$Email" PuzzelClientId ="$PuzzelClientId" PuzzelPassword ="$PuzzelPassword" PuzzelUser ="$PuzzelUser" PuzzelAccessPoint ="$PuzzelAccessPoint" OnErrorEmail ="$OnErrorEmail" } New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName ` -TemplateUri $TemplateFileUrl ` -TemplateParameterObject $ParametersObj