Functions/Get-SharePointOnlineUrl.ps1

<#
.SYNOPSIS
    This function constructs a SharePoint Online Url from the provided information
#>

function Get-SharePointOnlineUrl {
    [CmdletBinding(PositionalBinding=$true)]
    [OutputType([String])]
    param (
        # The name of the organization in Office 365.
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [String]$organizationName,

        # Whether the url will be /sites/ or /teams/.
        [Parameter(Mandatory=$true)]
        [ValidateSet("sites", "teams")]
        [String]$urlPath,

        # The name for the last portion of the url.
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [String]$urlName
    )
    return "https://$($organizationName).sharepoint.com/$($urlPath)/$($urlName)"
}