Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when create Storage with network property #1138

Open
baoduy opened this issue Sep 12, 2021 · 3 comments
Open

Error when create Storage with network property #1138

baoduy opened this issue Sep 12, 2021 · 3 comments
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec

Comments

@baoduy
Copy link

baoduy commented Sep 12, 2021

Hi, I got the below error when creating the storage with networkRuleSet property. Seems it try to read something from storage since the storage is not really created.

The storage had been created successfully after removing this property.

However, it was fine when set the property back on the second run after the storage is created.

azure-native:storage:StorageAccount (storagename):
    error: resource partially created but read failed autorest/azure: Service returned an error. Status=404 Code="StorageAccountNotFound" Message="The storage account sandboxappsstg was not found.": autorest/azure: Service returned an error. Status=404 Code="StorageAccountNotFound" Message="The storage account sandboxappsstg was not found."
@baoduy baoduy added the kind/bug Some behavior is incorrect or out of spec label Sep 12, 2021
@mikhailshilkov
Copy link
Member

Hi @baoduy Would it be possible to share a code snippet to reproduce this problem?

@mikhailshilkov mikhailshilkov added the awaiting-feedback Blocked on input from the author label Sep 13, 2021
@baoduy
Copy link
Author

baoduy commented Sep 15, 2021

Here is code that has the error

const stg = new storage.StorageAccount(name, {
    accountName: name,
    ...group,

    kind: storage.Kind.StorageV2,
    sku: {
      name:
        !enableStaticWebsite && isPrd
          ? storage.SkuName.Standard_ZRS
          : storage.SkuName.Standard_LRS,
    },
    accessTier: "Hot",

    isHnsEnabled: true,
    enableHttpsTrafficOnly: true,
    allowBlobPublicAccess: false,
    allowSharedKeyAccess: allowSharedKeyAccess,

    identity: { type: "SystemAssigned" },
    minimumTlsVersion: "TLS1_2",

    //1 Year Months
    keyPolicy: { keyExpirationPeriodInDays: 365 },

    customDomain:
      customDomain && !enableStaticWebsite
        ? { name: customDomain, useSubDomainName: true }
        : undefined,



    networkRuleSet: {
          bypass: "Logging, Metrics",
          defaultAction: "Allow",

          virtualNetworkRules: subnetId
            ? [{ virtualNetworkResourceId:subnetId }]
            : undefined,

          ipRules: ipAddresses
            ? ipAddresses.map((i) => ({
                iPAddressOrRange: i,
                action: "Allow",
              }))
            : undefined,
        }

    tags: defaultTags,
  });

And here is code that working fine

const stg = new storage.StorageAccount(name, {
    accountName: name,
    ...group,

    kind: storage.Kind.StorageV2,
    sku: {
      name:
        !enableStaticWebsite && isPrd
          ? storage.SkuName.Standard_ZRS
          : storage.SkuName.Standard_LRS,
    },
    accessTier: "Hot",

    isHnsEnabled: true,
    enableHttpsTrafficOnly: true,
    allowBlobPublicAccess: false,
    allowSharedKeyAccess:allowSharedKeyAccess,

    identity: { type: "SystemAssigned" },
    minimumTlsVersion: "TLS1_2",

    //1 Year Months
    keyPolicy: { keyExpirationPeriodInDays: 365 },

    customDomain:
      customDomain && !enableStaticWebsite
        ? { name: customDomain, useSubDomainName: true }
        : undefined,



    networkRuleSet: { defaultAction: "Allow" },

    tags: defaultTags,
  });

@mikhailshilkov mikhailshilkov removed the awaiting-feedback Blocked on input from the author label Sep 15, 2021
@mikhailshilkov
Copy link
Member

I logged the debug messages and got the following actual error (while getting the same message as you do):

Validation of network acls failure: SubnetsHaveNoServiceEndpointsConfigured:Subnets default of virtual network /subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/server-networkf do not have ServiceEndpoints for Microsoft.Storage resources configured. Add Microsoft.Storage to subnet's ServiceEndpoints collection before trying to ACL Microsoft.Storage resources to these subnets.."

I'll take a look why we hinder the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants