@Sathish Mugite I understand that there might be two issues here.
- The stg.example.com custom domain has not been added. Can you confirm the status of this site?
- You are receiving an error for the second site, dev.example.com when adding the same root custom domain used in the staging app.
While we await your reply for number 1, I want to confirm that the error message that you shared is correct. You cannot use the same root custom domain across multiple Azure Static Web Apps.
There are two alternatives to achieve what you are looking for. The first is to use Azure Static Web Apps Preview Environment feature. This feature allows you to view your changes before completing the pull request. This would eliminate the need for a dev/staging separate apps. See here for more information on this feature: https://learn.microsoft.com/en-us/azure/static-web-apps/preview-environments
The second workaround would be to use Azure Front Door. This would allow you to create an environment in Azure Front Door for the example.com domain. You could then create and assign subdomains to different Azure Static Web Apps to get around the error.
Please let us know if you have any questions or concerns.