列出存储帐户https://management.core.windows.net/ / services / storageservices
表示它列出了指定订阅中可用的存储帐户,并且获取存储帐户密钥仅适用于作为此调用的一部分返回的这些存储帐户。
但是回复只给我一些经典的存储帐户,我如何获得其他存储帐户?
答案 0 :(得分:0)
但是回复只给了我很少的存储帐户 经典,我如何获得其他存储帐户?
通过 public class RecyclerViewAnimationAdapter : RecyclerView.Adapter
{
private int m_LastPosition = -1;
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
base.OnBindViewHolder(holder, position);
animateItem(position, holder.ItemView);
}
public override void OnViewDetachedFromWindow(Object holder)
{
base.OnViewDetachedFromWindow(holder);
var viewToAnimate = ((RecyclerView.ViewHolder) holder).ItemView;
viewToAnimate.ClearAnimation();
}
private void animateItem(int position, View viewToAnimate)
{
if (position > m_LastPosition)
{
var animation = AnimationUtils.LoadAnimation(Application.Context, Resource.Animation.slide_in_bottom);
viewToAnimate.StartAnimation(animation);
m_LastPosition = position;
}
}
}
存储帐户,我猜您的意思是"other"
存储帐户。使用基于Azure AD的身份验证的ARM存储帐户有不同的API。
要了解有关列出存储帐户的ARM API的详情,请参阅以下链接:https://docs.microsoft.com/en-us/rest/api/storagerp/storageaccounts#StorageAccounts_List。
要详细了解如何验证/授权ARM API调用,请参阅以下链接:https://docs.microsoft.com/en-us/rest/api/
答案 1 :(得分:0)
我同意Gaurav Mantri的意见,如果您想在指定订阅下列出ARM存储帐户,请使用this API:
获取https://management.azure.com/subscriptions/ {subscriptionId} /providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01
以下代码示例在我这方面工作正常,请参考它。
string tenantId = "{tenantId}";
string clientId = "{clientId}";
string clientSecret = "{secret}";
string subscriptionid = "{subscriptionid}";
string authContextURL = "https://login.windows.net/" + tenantId;
var authenticationContext = new AuthenticationContext(authContextURL);
var credential = new ClientCredential(clientId, clientSecret);
var result = await authenticationContext.AcquireTokenAsync(resource: "https://management.azure.com/", clientCredential: credential);
if (result == null)
{
throw new InvalidOperationException("Failed to obtain the JWT token");
}
string token = result.AccessToken;
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(string.Format("https://management.azure.com/subscriptions/{0}/providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01", subscriptionid));
request.Method = "GET";
request.Headers["Authorization"] = "Bearer " + token;
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.GetResponse();
//extract data from response
}
catch (WebException ex)
{
//ex.Message;
}
此外,本文还介绍了如何create AD application and service principal that can access resources,请参考它。
答案 2 :(得分:0)
感谢您的回复,其他存储帐户我的意思是经典存储帐户下的存储帐户未被列出。 而不是使用 https://management.core.windows.net//services/storageservices
我使用了REST API 对于新的存储帐户 /management.azure.com/subscriptions/id/providers/Microsoft.Storage/storageAccounts?api-version=2016-12-01
代表经典: /management.azure.com/subscriptions//providers/Microsoft.ClassicStorage/storageAccounts?api-version =
并获得钥匙 /订阅/ {subscriptionId} / resourceGroups / {resourceGroupName} /providers/Microsoft.Storage/storageAccounts/ {帐户名} / listKeys?API-版本= 2016年12月1日
/订阅/ {subscriptionId} / resourceGroups / {resourceGroupName} /providers/Microsoft.ClassicStorage/storageAccounts/ {帐户名} / listKeys?API-版本= 2016年11月1日