API do Azure O servidor falhou ao autenticar a solicitação

Tenho uma tarefa (tentei com a função de trabalhador e carregue um aplicativo de console e execute o .exe) que deve ser executado uma vez por dia e reunir as métricas do Azure de algumas das minhas VMs. Isso funciona perfeitamente localmente, mas em um serviço em nuvem eu recebo este erro:

Exceção sem tratamento: Microsoft.WindowsAzure.CloudException: ForbiddenError: O servidor falhou ao autenticar a solicitação. Verifique se o certificado é válido e associado a esta assinatura. em Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSucces ... etc.

A linha onde isso acontece é:

MetricDefinitionListResponse metricListResponse = metricsClient.MetricDefinitions.List(resourceId, null,
            nspace);

Isso faz parte do meu código:

 string subscriptionId = "fc4xxxx5-835c-xxxx-xxx-xxxxxxx";

        // The thumbprint of the certificate.
        string thumbprint = "‎f5 b4 xxxxxxxx f7 c2";

        // Get the certificate from the local store.
        //X509Certificate2 cert = GetCertificate(StoreName.My, StoreLocation.LocalMachine, thumbprint);
        //cert = GetCertificate(StoreName.My, StoreLocation.CurrentUser, thumbprint) ?? new X509Certificate2(("manageAzure.cer"));
        var cert = new X509Certificate2(("manageAzure.cer"));

        Console.WriteLine("Certificate is : " + cert);

        // Create the metrics client.
        var metricsClient = new MetricsClient(new CertificateCloudCredentials(subscriptionId, cert));

        Console.WriteLine("metricsClient is : " + metricsClient);

        // The cloud service name and deployment name, found in the dashboard of the management portal.
        string cloudServiceName = "abms2-carlsberg";
        string deploymentName = "abms2-carlsberg";

        // Build the resource ID string.
        string resourceId = ResourceIdBuilder.BuildVirtualMachineResourceId(cloudServiceName, deploymentName);

        string nspace = "WindowsAzure.Availability";

        // Get the metric definitions.
        MetricDefinitionListResponse metricListResponse = metricsClient.MetricDefinitions.List(resourceId, null,
            nspace);

Coloquei o certificado de gerenciamento em minha solução e carrego-o a partir daí (ele está definido para sempre copiar) e é o mesmo (e da mesma maneira) que uso quando o executo localmente.

Então, de que "certificado" ele se queixa de "autenticar"? Não consigo ver qual é o problema. Qualquer ajuda seria muito apreciada, pois usei a tarde inteira nisso!

PS: Eu já estou executando isso no modo elevado!

questionAnswers(3)

yourAnswerToTheQuestion