Use a custom domain
Last updated: November 23, 2026
Overview
ShArc runs at the default address of its Azure App Service, for example https://sharc-contoso.azurewebsites.net. You can make it available under your own domain instead, for example https://sharc.contoso.com.
Binding the domain to the App Service is not enough on its own. ShArc signs users in through the address configured in the App Service setting SHARC_Http__HostName, which the installation sets to the default address. As long as that setting is unchanged, a sign-in through the custom domain ends in a sign-in loop: after authenticating, the page asks you to sign in again.
The script Set-ShArcCustomDomain.ps1 switches ShArc to the custom domain in one run:
- It checks that the domain is bound to the App Service with an SSL certificate.
- It adds the domain's sign-in addresses (redirect URIs) to the ShArc app registration in Microsoft Entra ID. The entries for the default address stay.
- It points the Restore with ShArc file handler at the domain. File handlers of other ShArc installations in the same tenant are not changed.
- It sets
SHARC_Http__HostNameto the domain. This restarts ShArc.
The script shows a summary and changes nothing until you confirm it. Running it again is safe: steps that are already done are skipped.
Archived files are not affected. A .sharc file does not contain the ShArc address, so all archived files can still be restored after the switch.
Before you start
- Bind the domain with an SSL certificate. In the Azure portal, open the ShArc App Service, go to Custom domains, add the domain and add a certificate binding. A free App Service managed certificate is sufficient.
- Check your permissions. You need:
- Website Contributor or Contributor on the ShArc App Service.
- The Entra role Application Administrator or Cloud Application Administrator, or ownership of both the ShArc app registration and the Restore with ShArc app registration.
- Choose a time without running jobs. The restart interrupts a running archive or restore job.
A domain that reaches ShArc through Azure Front Door or Azure Application Gateway, rather than being bound to the App Service itself, is not covered by the script. Please contact Layer2 support in that case.
Switch to the custom domain
We recommend running the script in Azure Cloud Shell, where PowerShell and the Azure CLI are ready and already signed in.
-
In the Azure portal, open Cloud Shell (the terminal icon in the top bar) and select PowerShell.
-
Download the script:
Invoke-WebRequest https://docs.layer2-sharc.com/scripts/Set-ShArcCustomDomain.ps1 -OutFile Set-ShArcCustomDomain.ps1 -
Preview the changes without applying them:
./Set-ShArcCustomDomain.ps1 -WhatIfThe script finds the ShArc App Service and the custom domain bound to it. If there are several of either, it asks which one to use.
-
Run the script and confirm the summary:
./Set-ShArcCustomDomain.ps1 -
Wait about a minute for ShArc to restart, then open ShArc through the custom domain and sign in.
You can also name everything explicitly, for example when the App Service is in another subscription:
./Set-ShArcCustomDomain.ps1 -CustomDomain sharc.contoso.com -AppServiceName sharc-contoso -Subscription "My subscription"
All parameters and examples are shown by Get-Help ./Set-ShArcCustomDomain.ps1 -Full.
You can also download the script and run it locally. It needs PowerShell 7.4 or later and a signed-in Azure CLI (az login). On Windows, unblock the downloaded file first with Unblock-File ./Set-ShArcCustomDomain.ps1.
After the switch
- Use only the custom domain. Signing in through the default azurewebsites.net address no longer works once ShArc uses the custom domain.
- Deploy the ShArc SharePoint solution again if you use it. Open the ShArc admin center through the custom domain and deploy the SharePoint solution (SPFx) again, so that restores started from SharePoint use the new address.
- Allow some time for the file handler. SharePoint and OneDrive can take a while to pick up the new file handler address.
- After an infrastructure update with installation package 1.14.3 or older, run the script again. These packages reset
SHARC_Http__HostNameto the default address. Newer packages keep the custom domain. - ShArc Desktop clients keep working with the address they were installed with. Changing it is optional.
Switch back to the default address
./Set-ShArcCustomDomain.ps1 -RevertToDefaultAddress
This sets ShArc and the file handler back to the azurewebsites.net address. The redirect URIs of the custom domain stay in the app registration, so switching again later needs no change there. Deploy the SharePoint solution again afterwards, as described above.
If something goes wrong
If a step fails, the script shows:
- which step failed and the original error message,
- what to do, for example which permission is missing,
- which changes were already made in this run.
Fix the cause and run the script again; finished steps are skipped.
Every run writes a log file named Set-ShArcCustomDomain-<date>-<time>.log to the current folder. In Cloud Shell, download it with Manage files > Download. Please attach it when you contact Layer2 support.