Easy way to access Azure software

I have the following code:

var client = new WebSiteManagementClient(creds);
var data = client.WebSites.Get("eastuswebspace", "some-site", new WebSiteGetParameters());

I need to generate credentials, I am an administrator with full access. Only one application accesses my data and you need to create TokenCloudCredentials.

I tried to register the application, but received a “forbidden” error after successfully creating the token. The easiest way to do this (e.g. Github, create a token and do it?).

Thank.

+4
source share
2 answers

I managed to get it to work with the following snippet. He just needs a certificate. Check if this works for you. You will need the Azure Publish Settings file (fingerprint from it).

public const string base64EncodedCertificate = "frompublishsettingsfile";
    public const string subscriptionId = "";

    static SubscriptionCloudCredentials getCredentials()
    {
        return new CertificateCloudCredentials(subscriptionId, new X509Certificate2(Convert.FromBase64String(base64EncodedCertificate)));
    }
    static void Main(string[] args)
    {
        WebSiteManagementClient client = new WebSiteManagementClient(getCredentials());
+2

Token, Azure.

:

makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss My "<CertificateName>.cer"

Azure, . , :

Get-AzurePusblishSettingsFile

, publishprofile:

enter image description here

, Alex Belotserkovskiy, SDK Azure Management.

- , .

+2

All Articles