title: Using management certificate with azure REST API
body: <p>I'm using azure service management REST API in my application. I uploaded the management certificate on azure and have a copy in local.
  I keep the certification in a separate folder (AzureCertificate) in the application itself and referring to that location.
  e.g:</p>
  <blockquote>
  <p>string certificatePath = Server.MapPath(&quot;~/AzureCertificate/&quot;) +
  certificateName;</p>
  <p>X509Certificate2 certificate = new X509Certificate2(certificatePath);</p>
  <p>AzureCertificate -- Folder name certificateName -
  MyCertificatieName.cer</p>
  </blockquote>
  <p>it works fine when I run the application my local development environment. But I'm getting the below error when I deploy the same in azure website.</p>
  <blockquote>
  <p>The remote server returned an error: (403) Forbidden</p>
  </blockquote>
  <p>This is how I make the request</p>
  <blockquote>
  <p>string uri = apiURL + subscriptionId + &quot;/services/hostedservices&quot;;</p>
  <p>HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uri);</p>
  <p>X509Certificate2 certificate = new X509Certificate2(certificatePath);</p>
  <p>req.ClientCertificates.Add(certificate);</p>
  <p>req.Headers.Add(&quot;x-ms-version&quot;, &quot;2009-10-01&quot;); HttpWebResponse res =</p>
  <p>(HttpWebResponse)req.GetResponse();</p>
  </blockquote>
  <p>But it throws the above said exception at the last line (req.GetResponse()).</p>
  <p>Can we use the management certificate in this way?.</p>
  <p>My requirement is to develop an application which uses the azure REST API and deploy in azure.</p>