以编程方式访问天蓝色的最简单方法 [英] Simplest way to access azure programmatically

查看:99
本文介绍了以编程方式访问天蓝色的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

  var client = new WebSiteManagementClient(creds);var data = client.WebSites.Get("eastuswebspace",某些站点",新的WebSiteGetParameters()); 

我需要生成凭据,我是具有完全访问权限的管理员.只有一个应用程序访问我的数据,并且需要生成TokenCloudCredentials.

我尝试注册一个应用程序,但在成功生成令牌后收到禁止"错误.是否有最简单的方法(例如Github,生成令牌并完成?).

谢谢.

解决方案

要生成令牌凭据,您需要创建一个证书并将其上载到Azure.

首先,您可以使用以下命令行创建证书:

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

然后,有必要通过遵循

然后,您可以使用 Alex Belotserkovskiy 提出的代码来通过Azure管理SDK进行身份验证.

此处是完整的博客文章,其中显示了所有步骤.

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 admin with full access. Only one App accessing my data and need to generate a TokenCloudCredentials.

I tried registering an App but getting a "forbidden" error after successfully generating the token. Is there a simplest way of doing this (like Github, generate a token and it's done?).

Thanks.

解决方案

To generate a Token Credentials, you need to create a certificate and upload it on Azure.

First, you can create a certificate using this command line :

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

Then, it's necessary to upload it on Azure by following this process. Once it's uploaded, you can get the publishsettings file to obtain the certificate management thumbprint with this power shell command line :

Get-AzurePusblishSettingsFile

The following screen shot shows where to find the certificate management thumbprint in the publishprofile :

Then you can use the code proposed by Alex Belotserkovskiy to get authenticated with the Azure Management SDK.

Here is a complete blog post which shows all steps.

这篇关于以编程方式访问天蓝色的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆