Firstly, App Service support HTTPS on *.azurewebsites.net
domain name and the certificate is provided and owned by Azure.
I understand the requirement of removing the default domain, but there is no way disable it. You could instead accomplish this by adding a rewrite rule
(Or Redirect rule).
A rule to detect if the user has accessed the website using the Azure default domain and issue a HTTP 301 or 403.
Also, ensure that you have changed the site address from mydomain.azurewebsites.net to mydomain.com. from the WordPress settings
Just to highlight, by default, http://yourdomain.azurewebsites.net works even with custom domain added, and the site admins aware about the URL can access, but typically end users would not access this URL directly (unless explicitly shared).
Reference on other approaches outlined in the similar discussion threads:
- can-we-remove-disable-http-domain-azurewebsites-ne
- prevent-azure-default-domains-being-indexed-search-engines-anton-pham
- How to make sure that google doesn't index you Azure subdomain? - You may try adding a robot.txt file for Google indexing the site as mentioned by Peter on SO discussion thread.
Additionally,
Azure App Service on Linux images using PHP 8.x are now bundled with NGINX instead of Apache.
NGINX Rewrite Rules for Azure App Service Linux PHP 8.x