繁体   English   中英

为 Azure 存储帐户创建专用终结点连接时出现 ResourceNotFound 错误

[英]ResourceNotFound error when creating Private Endpoint connection for Azure storage account

我正在尝试根据此文档为我的 Azure 存储帐户设置专用端点连接,但我收到此错误

  azure-native:storage:PrivateEndpointConnection (privateEndpointConnection):
    error: cannot check existence of resource '/subscriptions/my_sub_id/resourceGroups/my_resource_group_id /providers/Microsoft.Storage/storageAc
counts/my_storage_account_name/privateEndpointConnections/privateEndpointConnection': status code 400, {"error":{"code":"ResourceNotFound","message":"The Resource Microsoft.St
orage/storageAccounts/my_storage_account_name/privateEndpointConnections/privateEndpointConnection under resource group my_resource_group_id was not found."}}

这是我的 Pulumi 堆栈代码

var resourceGroup = new ResourceGroup(resourceGroupName, new ResourceGroupArgs
{
    ResourceGroupName = resourceGroupName,
});

var virtualNetwork = new VirtualNetwork("vnet", new VirtualNetworkArgs
{
    ResourceGroupName = resourceGroup.Name,
    Location = resourceGroup.Location,
    AddressSpace = new AddressSpaceArgs { AddressPrefixes = new [] { "10.96.0.0/16" } },
});

var publicSubnet = new Subnet("public-subnet", new Pulumi.AzureNative.Network.SubnetArgs
{
    ResourceGroupName = resourceGroup.Name,
    VirtualNetworkName = virtualNetwork.Name,
    AddressPrefix = "10.96.0.0/27",
    Delegations =
    {
        new DelegationArgs { Name = "Microsoft.Web.serverFarms", ServiceName = "Microsoft.Web/serverFarms" },
    }
});

var privateEndpointSubnet = new Subnet("private-endpoint-subnet", new Pulumi.AzureNative.Network.SubnetArgs
{
    ResourceGroupName = resourceGroup.Name,
    VirtualNetworkName = virtualNetwork.Name,
    AddressPrefix = "10.96.1.0/27",
    PrivateEndpointNetworkPolicies = VirtualNetworkPrivateEndpointNetworkPolicies.Disabled,
    PrivateLinkServiceNetworkPolicies = VirtualNetworkPrivateLinkServiceNetworkPolicies.Enabled,
});

var storageAccount = new StorageAccount("storageaccount", new StorageAccountArgs
{
    ResourceGroupName = resourceGroup.Name,
    Sku = new SkuArgs
    {
        Name = SkuName.Standard_LRS
    },
    NetworkRuleSet = new NetworkRuleSetArgs
    {
        Bypass = Bypass.AzureServices,
        DefaultAction = DefaultAction.Deny,
    },
    Kind = Kind.StorageV2
});

var privateEndpointConnection = new PrivateEndpointConnection("privateEndpointConnection", new PrivateEndpointConnectionArgs
{
    AccountName = storageAccount.Name,
    ResourceGroupName = resourceGroup.Name,
    PrivateLinkServiceConnectionState = new PrivateLinkServiceConnectionStateArgs
    {
        Description = "Auto-Approved",
        Status = "Approved",
        ActionRequired = "None"
    },
});

无法弄清楚我错过了什么,非常感谢任何帮助。

这个(azure-ts-webapp-privateendpoint-vnet-injection)Pulumi 示例帮助我解决了我的问题,并且我能够为我的存储帐户使用私有端点连接

var storageAccount = new StorageAccount("storageaccount", new StorageAccountArgs
{
    ResourceGroupName = resourceGroup.Name,
    Sku = new SkuArgs
    {
        Name = SkuName.Standard_LRS
    },
    Kind = Kind.StorageV2
});

var privateDnsZone = new PrivateZone("private-dns-zone", new PrivateZoneArgs
{
    ResourceGroupName = resourceGroup.Name,
    Location = "global",
    PrivateZoneName = "privatelink.azurewebsites.net",
});
var privateEndpoint = new PrivateEndpoint("account-storage-private-endpoint", new PrivateEndpointArgs
{
    ResourceGroupName = resourceGroup.Name,
    PrivateEndpointName = "account-storage-private-endpoint",
    PrivateLinkServiceConnections = 
    {
        new PrivateLinkServiceConnectionArgs
        {
            GroupIds = 
            {
                "blob",
            },
            Name = "private-link-connection",
            PrivateLinkServiceId = storageAccount.Id,
        },
    },
    Subnet = new SubnetArgs { Id = privateEndpointSubnet.Id, },
});
new PrivateDnsZoneGroup("private-dns-zone-group", new PrivateDnsZoneGroupArgs
{
    ResourceGroupName = resourceGroup.Name,
    PrivateDnsZoneGroupName = privateEndpoint.Name,
    PrivateEndpointName = privateEndpoint.Name,
    PrivateDnsZoneConfigs =
    {
        new PrivateDnsZoneConfigArgs
        {
            Name = "config",
            PrivateDnsZoneId = privateDnsZone.Id,
        }
    },
});
new VirtualNetworkLink("virtual-network-link", new VirtualNetworkLinkArgs
{
    ResourceGroupName = resourceGroup.Name,
    PrivateZoneName = privateDnsZone.Name,
    RegistrationEnabled = false,
    Location = "global",
    VirtualNetwork = new SubResourceArgs { Id = virtualNetwork.Id }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM