func (az *Cloud) getStorageAccounts(accountOptions *AccountOptions) ([]accountWithLocation, error) {
	ctx, cancel := getContextWithCancel()
	defer cancel()
	result, rerr := az.StorageAccountClient.ListByResourceGroup(ctx, accountOptions.ResourceGroup)
	if rerr != nil {
		return nil, rerr.Error()
	}
	accounts := []accountWithLocation{}
	for _, acct := range result {
		if acct.Name != nil && acct.Location != nil && acct.Sku != nil {
			storageType := string((*acct.Sku).Name)
			if accountOptions.Type != "" && !strings.EqualFold(accountOptions.Type, storageType) {
				continue
			}
			if accountOptions.Kind != "" && !strings.EqualFold(accountOptions.Kind, string(acct.Kind)) {
				continue
			}
			location := *acct.Location
			if accountOptions.Location != "" && !strings.EqualFold(accountOptions.Location, location) {
				continue
			}
			if len(accountOptions.VirtualNetworkResourceIDs) > 0 {
				if acct.AccountProperties == nil || acct.AccountProperties.NetworkRuleSet == nil ||
					acct.AccountProperties.NetworkRuleSet.VirtualNetworkRules == nil {
					continue
				}
				found := false
				for _, subnetID := range accountOptions.VirtualNetworkResourceIDs {
					for _, rule := range *acct.AccountProperties.NetworkRuleSet.VirtualNetworkRules {
						if strings.EqualFold(to.String(rule.VirtualNetworkResourceID), subnetID) && rule.Action == storage.Allow {
							found = true
							break
						}
					}
				}
				if !found {
					continue
				}
			}
			accounts = append(accounts, accountWithLocation{Name: *acct.Name, StorageType: storageType, Location: location})
		}
	}
	return accounts, nil
}
getStorageAccounts get matching storage accounts
package azure
import (
	"fmt"
	"strings"
	"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
	"github.com/Azure/go-autorest/autorest/to"
	"k8s.io/klog/v2"
)
type AccountOptions struct {
	Name, Type, Kind, ResourceGroup, Location string
	EnableHTTPSTrafficOnly                    bool
	Tags                                      map[string]string
	VirtualNetworkResourceIDs                 []string
}
type accountWithLocation struct {
	Name, StorageType, Location string
}