Wenn Sie zweiten Standort zu lesen bedeutet, denke ich, Azure ARM-Management könnte uns dabei helfen. Ich habe versucht, es auf meinem lokalen und das Ergebnis als Folgendes erhalten:
[Update]
Hier ist mein Testcode:
public async Task<string> GetToken()
{
AuthenticationResult result = null;
string test;
AuthenticationContext authContext = new AuthenticationContext(adInfo.AuthUrl + adInfo.Telnant);
ClientCredential cc = new ClientCredential(adInfo.ClientId, adInfo.ClientSecret);
try
{
result = await authContext.AcquireTokenAsync(adInfo.Resource,cc);
test = result.AccessToken;
return test;
}
catch (AdalException ex)
{
return ex.Message;
}
}
public async Task GetSQLInfo()
{
string token = await GetToken();
var sqlclient = new SqlManagementClient(new TokenCloudCredentials(adApplication.Subscription, token));
var data = await sqlclient.Databases.GetAsync("jatestgroup", "jaserver", "jasql");
}
Hier ist mein Klasse über adInfo und adApplication:
public class AdInfo
{
[JsonProperty(PropertyName = "clientid")]
public string ClientId { get; set; }
[JsonProperty(PropertyName = "clientsecret")]
public string ClientSecret { get; set; }
[JsonProperty(PropertyName = "returnurl")]
public string ReturnUrl { get; set; }
[JsonProperty(PropertyName = "telnantid")]
public string Telnant { get; set; }
[JsonProperty(PropertyName = "authurl")]
public string AuthUrl { get; set; }
[JsonProperty(PropertyName = "resource")]
public string Resource { get; set; }
}
public class AdApplication
{
[JsonProperty(PropertyName = "ARMTemplate")]
public AdInfo Application { get; set; }
[JsonProperty(PropertyName = "subscription")]
public string Subscription { get; set; }
}
Meine Json Einstellungen:
{
"ARMTemplate": {
"clientid": "****",
"clientsecret": "****",
"returnurl": "http://localhost:20190",
"telnantid": "****",
"authurl": "https://login.microsoftonline.com/",
"resource": "https://management.core.windows.net/"
},
"subscription": "***"
}
Da diese Frage mehr im Zusammenhang mit Auth fehlgeschlagen. Ich würde vorschlagen, dass du einen neuen Thread erstellst und mehr Informationen für uns gibst, wenn mein Code dir keine Hilfe gibt.
tut diese Hilfe: https: //msdn.microsoft.com/en-us/library/azure/mt600929.aspx – TheGameiswar
Ja, ich fand es früher, aber sieht aus wie es ist noch nicht im Client implementiert. Ich denke, ich muss es schreiben;) Danke! –