读取存储帐户的防火墙IP列表

时间:2018-07-11 10:42:47

标签: c# api asp.net-web-api azure-storage-account

是否可以使用C#代码(即存储帐户api)以天蓝色读取存储帐户的允许IP范围列表

1 个答案:

答案 0 :(得分:0)

  

是否可以使用c#代码(即存储帐户api)以天蓝色读取存储帐户的允许IP范围列表。

是的,我们可以使用Azure Fluent SDK来做到这一点。有关如何获取身份验证文件,请参阅其他SO thread

using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;


var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"auth file path");
var azure = Azure
            .Configure()
            .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
            .Authenticate(credentials)
            .WithDefaultSubscription();
var account = azure.StorageAccounts.GetByResourceGroup(resoureGroup, accountName);
var ipRange = account.IPAddressRangesWithAccess;

测试结果: enter image description here