private static async Task VisitStorageAccount()

in src/PSRule.Rules.Azure/Pipeline/Export/ResourceExportVisitor.cs [499:531]


    private static async Task<bool> VisitStorageAccount(ResourceContext context, JObject resource, string resourceType, string resourceId)
    {
        if (!string.Equals(resourceType, TYPE_STORAGE_ACCOUNTS, StringComparison.OrdinalIgnoreCase))
            return false;

        // Get blob services.
        if (resource.TryGetProperty(PROPERTY_KIND, out var kind) &&
            !string.Equals(kind, "FileStorage", StringComparison.OrdinalIgnoreCase))
        {
            var blobServices = await GetSubResourcesByType(context, resourceId, "blobServices", APIVERSION_2023_01_01);
            AddSubResource(resource, blobServices);
            foreach (var blobService in blobServices)
            {
                AddSubResource(resource, await GetSubResourcesByType(context, blobService[PROPERTY_ID].Value<string>(), PROPERTY_CONTAINERS, APIVERSION_2023_01_01));
            }
        }

        // Get file services.
        else if (kind != null &&
            !string.Equals(kind, "BlobStorage", StringComparison.OrdinalIgnoreCase) &&
            !string.Equals(kind, "BlockBlobStorage", StringComparison.OrdinalIgnoreCase))
        {
            var blobServices = await GetSubResourcesByType(context, resourceId, "fileServices", APIVERSION_2023_01_01);
            AddSubResource(resource, blobServices);
            foreach (var blobService in blobServices)
            {
                AddSubResource(resource, await GetSubResourcesByType(context, blobService[PROPERTY_ID].Value<string>(), PROPERTY_SHARES, APIVERSION_2023_01_01));
            }
        }

        AddSubResource(resource, await GetSubResourcesByProvider(context, resourceId, PROVIDERTYPE_DEFENDERFORSTORAGESETTINGS, "2022-12-01-preview", ignoreNotFound: true));
        return true;
    }