Skip to content

SPAlternateUrl

dscbot edited this page Mar 17, 2023 · 19 revisions

SPAlternateUrl

Parameters

Parameter Attribute DataType Description Allowed Values
WebAppName Key String The name of the web application to apply the alternate URL to
Zone Key String The Zone to use for the alternate URL Default, Intranet, Extranet, Custom, Internet
Url Key String The new alternate URL
Internal Write Boolean Specifies if the URL has to be configured as internal
Ensure Write String Present ensures the URL is set for this zone on this web app, Absent ensures it is removed Present, Absent

Description

Type: Distributed Requires CredSSP: No

This resource is used to define an alternate access mapping URL for a specified web application. These can be assigned to specific zones for each web application. Alternatively a URL can be removed from a zone to ensure that it will remain empty and have no alternate URL.

The default value for the Ensure parameter is Present. When not specifying this parameter, the setting is configured.

Central Administration

To select the Central Administration site, use the following command to retrieve the correct web application name: (Get-SPWebApplication -IncludeCentralAdministration | Where-Object { $_.IsAdministrationWebApplication }).DisplayName

To update the existing Default Zone AAM for Central Administration (e.g. to implement HTTPS), use the above command to retrieve the web application name (by default, it will be "SharePoint Central Administration v4") and specify "Default" as the Zone. If you wish to add AAM's instead, you may use the other zones to do so.

Using SPAlternateUrl to update the Default Zone AAM for Central Administration will update the AAM in SharePoint as well as the CentralAdministrationUrl value in the registry. It will not, however, update bindings in IIS. It is recommended to use the xWebsite resource from the xWebAdministration module to configure the appropriate bindings in IIS.

Examples

Example 1

This example shows how to add a new alternate URL to a specific web application

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )

    Import-DscResource -ModuleName SharePointDsc

    node localhost
    {
        SPAlternateUrl CentralAdminAAM
        {
            WebAppName           = "SharePoint - www.domain.com80"
            Zone                 = "Intranet"
            Url                  = "https://admin.sharepoint.contoso.com"
            Internal             = $false
            Ensure               = "Present"
            PsDscRunAsCredential = $SetupAccount
        }
    }
}

Example 2

This example shows how to remove an alternate URL from a specified zone for a specific web application.

    Configuration Example
    {
        param
        (
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount
        )

        Import-DscResource -ModuleName SharePointDsc

        node localhost
        {
            SPAlternateUrl CentralAdminAAM
            {
                WebAppName           = "SharePoint - www.domain.com80"
                Zone                 = "Intranet"
                Url                  = "http://www.externaldomain.com"
                Internal             = $false
                Ensure               = "Absent"
                PsDscRunAsCredential = $SetupAccount
            }
        }
    }
Clone this wiki locally