Hi @Dhruv-5639
As you have shared the below command which makes me believe that the 'TenantId' key is the part of $settings object. Please correct me if my understanding is wrong.
Set-AzureRMWebAppSlot -Name $name -ResourceGroupName $group -AppSettings $settings -Slot $slot
If you are getting "TenantId already exists" for the object $settings then that means you are trying to add the same key to the object $settings and it is already present. So you only need to update the value for the key rather than adding the object again. Below is the sample script to update the value
$webApp = Get-AzureRMWebAppSlot -ResourceGroupName $myResourceGroup -Name $mySite -Slot $slotName $appSettingList = $webApp.SiteConfig.AppSettings
$newvalue = @{}
ForEach ($oldvalue in $appSettingList) {
$newvalue[$oldvalue.Name] = $oldvalue.Value
}
$newvalue['TenantId'] = "yournewvalue"
Set-AzureRMWebAppSlot -ResourceGroupName $myResourceGroup -Name $mySite -AppSettings $newvalue -Slot $slotName
If the error is coming from different object/command please share the full error message or screenshot