Try the following:
# Variables
$ResourceGroup = "<YourResourceGroup>"
$ApplicationName = "<YourApplicationName>"
$SlotName = "<YourSlotName>"
# Create the slot
New-AzWebAppSlot -ResourceGroupName $ResourceGroup -Name $ApplicationName -Slot $SlotName -ErrorAction Stop
# Clear AppSettings
$slotAppSettings = @{}
Set-AzWebAppSlot -ResourceGroupName $ResourceGroup -Name $ApplicationName -Slot $SlotName -AppSettings $slotAppSettings
# Clear ConnectionStrings
$slotConnectionStrings = @{}
Set-AzWebAppSlot -ResourceGroupName $ResourceGroup -Name $ApplicationName -Slot $SlotName -ConnectionStrings $slotConnectionStrings
# Clear PathMappings (Virtual Applications and Directories)
$slotPathMappings = @{}
Set-AzWebAppSlot -ResourceGroupName $ResourceGroup -Name $ApplicationName -Slot $SlotName -VirtualApplications $slotPathMappings
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin