Setup-Epp.ps1

#Requires -Version 7.0
<#
.SYNOPSIS
    Run the installed Epp.Setup module using bundled tools and direct Function release downloads.
.DESCRIPTION
    Prefer Invoke-EppSetup after installing Epp.Setup. This compatibility entry point uses
    a packaged module beside the script, or an installed Epp.Setup module.
    A source checkout must first be packaged with package-setup.ps1.
.EXAMPLE
    .\Setup-Epp.ps1 -ForceAuthentication
#>

[CmdletBinding()]
param(
    [string] $TenantId,
    [string] $SubscriptionId,
    [string] $ApplicationId,
    [string] $Location,
    [string] $Provider,
    [string] $EndpointRegion,
    [string] $ResourcePrefix,
    [string] $Language,
    [string] $PackageReleaseTag = 'latest',
    [string] $ServicePlan,
    [ValidateSet('Create', 'Reuse', 'Replace')]
    [string] $CertificateAction,
    [string] $EncryptionKeyId,
    [string] $KeyVaultCertificateId,
    [string] $KeyVaultSubscriptionId,
    [string] $OutputDirectory = (Join-Path (Get-Location).Path 'epp-output'),
    [switch] $NonInteractive,
    [switch] $InstallPrerequisites,
    [switch] $ForceAuthentication,
    [switch] $ApproveDeployment
)

$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$manifest = Join-Path $PSScriptRoot 'Epp.Setup.psd1'
if (Test-Path -LiteralPath $manifest -PathType Leaf) {
    Import-Module $manifest -ErrorAction Stop
}
else {
    if (-not (Get-Module -ListAvailable Epp.Setup | Where-Object Version -ge ([Version]'0.6.0'))) {
        throw 'Install a reviewed Epp.Setup module version before running this wrapper. See the repository setup guide; this script does not download or install modules.'
    }
    Import-Module Epp.Setup -MinimumVersion 0.6.0 -ErrorAction Stop
}
$arguments = @{} + $PSBoundParameters
$arguments.OutputDirectory = $OutputDirectory
Epp.Setup\Invoke-EppSetup @arguments