Azure Webapp-Azure .Net SDK-设置站点IP限制

问题描述 投票:0回答:1

我正在尝试使用Azure .Net SDK来检索然后操纵Webapp中的资源。

我特别希望按照此处https://docs.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions#programmatic-manipulation-of-access-restriction-rules的说明设置服务IP限制,但必须通过SDK进行操作。我了解通用资源可能是对此的最佳选择?

我有以下代码可以获取网站信息,但是我对于确定子资源的资源ID的获取方法一无所知

            var credentials = new AzureCredentials(servicePrincipal, tenantId, AzureEnvironment.AzureGlobalCloud);
            IAzure azure = Azure.Authenticate(credentials).WithSubscription(subscriptionId);


            IWebApp webapp = servicePlan.Manager.WebApps.List().First();
IGenericResource grWebsiteByName = webapp.Manager.ResourceManager.GenericResources.GetById(" "/subscriptions/xxx-xxx-xxx/resourceGroups/MyResourceGroup/providers/Microsoft.Web/sites/MyFirstAzureWebsite-xxx");

azure azure-web-app-service whitelist azure-sdk-.net
1个回答
0
投票

您可以使用SiteConfigResourceInner.IpSecurityRestrictions设置webapp的IP安全限制。以下代码用于设置IP限制。您可以按照此SiteConfigResourceInner.IpSecurityRestrictions获取更多详细信息。

article
© www.soinside.com 2019 - 2024. All rights reserved.