我对如何在Azure .NET SDK中创建凭据而不必从本地文件中调用凭据感到有点迷失。
在我的情况下,我有几个订阅,我将我的数据存储在本地数据库中。我想使用我存储在数据库中的凭据为我的VM多次调用Azure。
他们有许多类表示在SDK Documentation中进行身份验证的方法,但我无法通过明确的方式创建访问令牌或使用凭据(租户ID,订阅ID,客户端ID和秘密) SDK。
例如,在调用其中一个客户端类(ComputeManagementClient)时,您可以使用凭据调用它来验证对Azure的请求,但他们似乎不提供类来生成超出{的凭据。 {3}}
有没有人有MSDN参考?
答案 0 :(得分:1)
根据AzureCredentialsFactory课程,我们可以知道我们也可以获得凭据FromServicePrincipal或FromUser。在您的情况下,我建议使用FromServicePrincipal和Microsoft.Azure.Management.Fluent来操作Azure资源。我也做了一个演示。
注意:如何注册Azure AD应用程序并分配角色请参阅此document。
protected override IEnumerator InitUI()
{
// 3DS UI .
Transform tf = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 0)");
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/minimap_type_b (x_ 1575, 1356)", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/replay", tf));
tf = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 1~2)");
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/logo", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/card_open_window", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/ranking", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/top_bar", tf));
tf = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 10~11)");
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/midterm_loading", tf));
tf = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 12)");
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/Screen3DUI/game_result", tf));
loading.SetValue(0.02f); // 2%.
//3DS UI
{
Screen3DUI screen_3d = gameObject.AddComponent<Screen3DUI>();
MiniMapUI_TypeB minimap = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 0)/minimap_type_b (x_ 1575, 1356)").GetComponent<MiniMapUI_TypeB>();
ReplayUI replay = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 0)/replay").GetComponent<ReplayUI>();
InGameLogo logo = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 1~2)/logo").GetComponent<InGameLogo>();
BetBoardCardOpenWindow card_open_window = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 1~2)/card_open_window").GetComponent<PC_CardBoard>();
RankingUI ranking = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 1~2)/ranking").GetComponent<RankingUI>();
BetBoardTopBar topbar = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 1~2)/top_bar").GetComponent<BetBoardTopBar>();
MidtermLoading mid_loading = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 10~11)/midterm_loading").GetComponent<MidtermLoading>();
ResultUI result = transform.Find("UI Root/FullscreenPanel/Screen3DUI/panel (depth 12)/game_result").GetComponent<CC_US_ResultWindow>();
//[PK CODE 1/18/2018]
MC_HorseRacingType racing_type = gameObject.AddComponent<MC_HorseRacingType>();
screen_3d.InjectObject(logo, replay, minimap, card_open_window, ranking, topbar, mid_loading, result);
yield return StartCoroutine(minimap.Init());
yield return StartCoroutine(replay.Init());
yield return StartCoroutine(logo.Init());
yield return StartCoroutine(card_open_window.Init());
yield return StartCoroutine(ranking.Init());
yield return StartCoroutine(topbar.Init());
yield return StartCoroutine(result.Init());
loading.SetValue(0.03f); // 3%
}
tf = transform.Find("UI Root/FullscreenPanel/UserConsoleUI/panel (depth 4~5)");
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/UserConsoleUI/bet_board", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/UserConsoleUI/bottom_bar", tf));
tf = transform.Find("UI Root/FullscreenPanel/UserConsoleUI/panel (depth 8~9)");
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/UserConsoleUI/dealer_cam", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/UserConsoleUI/bet_message", tf));
yield return StartCoroutine(LoadAsync("MC_VERSION/{0}/UI/UserConsoleUI/round_message", tf));
loading.SetValue(0.04f); // 4%.
}