I installed .pfx on my Azure website using the management port download certificate.
I recently had to go through this process for Azure Web Site, so I tried to save time in that order.
What can you do for debugging?
First remove the machine and find out if the certificate exists there. You may find that using mmc.exe and adding certificate snap-ins. See here for complete instructions.
In the case of the Azure Web Site, you must enable Remote Desktop by going to the Azure Management Portal , and then create a session in the virtual machine on which your website is deployed.
Certificate Deployment
If the certificate does not exist, you will have to deploy it. For testing, you can do this manually by going to virtual machines using a remote session and importing the certificate.
In the case of a website, if you want it to be deployed automatically, you will have to update the service definition files for this role to ensure that the certificate is deployed correctly. Also, keep in mind that your certificate must be uploaded as a "Service Certificate" and not a "Management Certificate" if you want your roles to be able to use it. If you are using Visual studio, you can also add it to your project and which can deploy it.
Access rights
In addition (and especially if you manually deployed the certificate, for example, in a virtual machine), you will need to verify that IIS has permissions to access the certificate. This page here explains how to deploy certificates and grant permissions. If your certificate is included in the deployment package, then this is not necessary, as Azure Deployment will take care of this.
FYI: it works locally because the certificate already exists in the repository where your code is viewed, and nothing will be possible to delete the certificate (unless you do it manually) to make sure that if you deployed locally again, the certificate (it is assumed that your deployment is on-premises and the Azure cloud is exactly the same). In many cases, the on-premises and Azure cloud environments may be different (unfortunately) because Azure will provide clean virtual machines and everything needs to be deployed properly. On local machines, we have a lot of "leftovers."