Public/Set-Config.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<#
    .SYNOPSIS
    Set the script level configuration

    .DESCRIPTION
    Sets the script level configuration

    .INPUTS
    None. You cannot pipe objects to Set-Config.

    .OUTPUTS
    None.

    .PARAMETER Config
    The configuration object
#>

function Set-Config {
    param(
        [Parameter(ValueFromPipeline)]
        [PSObject]
        $config,

        [Switch]
        $SkipIamAuthentication
    )
    Set-Variable -Name __config -Scope Script -Value $config

    $script:__sfAuth = Invoke-SfAuthenticate

    if (-not $SkipIamAuthentication) {
        # authenticate IAM using information from the salesforce org's configuration
        Invoke-IamAuthenticate
    }
}