Public/Add-CitrixStoreFront.ps1

function Add-CitrixStoreFront {
    <#
.SYNOPSIS
    Adds a Citrix StoreFront Load Balancing configuration to your Citrix ADC.
.DESCRIPTION
    Adds a Citrix StoreFront Load Balancing configuration to your Citrix ADC.
    The configuration data for this function is driven by the "StoreFront" section of the JSON file passed in.
.PARAMETER JSONFile
    The JSON file containing the data to be used to configure the Citrix Licensing GSLB configuration.
.NOTES
    Creation Date: 20/06/2018
.CHANGE CONTROL
    Name Version Date Change Detail
    David Brett 1.0 20/06/2018 Function Creation
.EXAMPLE
    Add-CitrixStoreFront -JSONFile C:\CitrixADC\CitrixADC-Build.json

    Add-CitrixStoreFront -JSONFile C:\CitrixADC\CitrixADC-Build.json -Verbose
#>


    [CmdletBinding()]
    Param (
        [parameter(Mandatory = $false, ValueFromPipeline = $true)][string[]]$JSONFile
    )

    # Read in the JSON File
    if (test-path $JSONfile) {
        try {
            $JSON = Get-Content -Raw -Path $JSONfile | ConvertFrom-Json -ErrorAction Stop
        }
        catch {
            throw "Error reading JSON. Please Check File and try again."
        }
    }

    # Read in data from the JSON File

    # Generate Citrix ADC Credentials
    $SecurePassword = ConvertTo-SecureString $JSON.Global.ADCPassword -AsPlainText -Force
    $ADCCredentials = New-Object System.Management.Automation.PSCredential ($JSON.Global.ADCUserName, $SecurePassword)

    Write-Verbose "Starting to add Citrix StoreFront Load Balancing Configuration to the Citrix ADC"

    # Connect to the Citrix ADC
    Connect-CitrixADC -IPAddress $JSON.Global.NetScalerIP -Credential $ADCCredentials

    # Disconnect from the Citrix ADC
    Disconnect-CitrixADC
    
    Write-Verbose "Finished adding Citrix StoreFront Load Balancing Configuration to the Citrix ADC"

}