Repository: kubernetes-sigs/cloud-provider-azure
Pull request #5272 (2024-01-11 06:40:24)

Refactor:remove managed disk controller
<!--  Thanks for sending a pull request!  Here are some tips for you:

1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
4. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
5. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

#### What type of PR is this?
/kind cleanup

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind design

Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:

#### Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
-->
```release-note
NONE
```

#### Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

<!--
This section can be blank if this pull request does not require a release note.

When adding links which point to resources within git repositories, like
KEPs or supporting documentation, please reference a specific commit and avoid
linking directly to the master branch. This ensures that links reference a
specific point in time, rather than a document that may change over time.

See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files

Please use the following format for linking documentation:
- [KEP]: <link>
- [Usage]: <link>
- [Other doc]: <link>
-->
```docs

```


k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/cloud-provider-azure/pull/5272#" title="Author self-approved">MartinForReal</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fcloud-provider-azure).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/cloud-provider-azure/blob/master/OWNERS)~~ [MartinForReal]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
k8s-ci-robot: @MartinForReal: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
pull-cloud-provider-azure-unit | 437c90417e2589898233dd6429fa17e53cffac00 | [link](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cloud-provider-azure/5272/pull-cloud-provider-azure-unit/1745334840594534400) | true | `/test pull-cloud-provider-azure-unit`

[Full PR test history](https://prow.k8s.io/pr-history?org=kubernetes-sigs&repo=cloud-provider-azure&pr=5272). [Your PR dashboard](https://prow.k8s.io/pr?query=is%3Apr%20state%3Aopen%20author%3AMartinForReal). Please help us cut down on flakes by [linking to](https://git.k8s.io/community/contributors/devel/sig-testing/flaky-tests.md#filing-issues-for-flaky-tests) an [open issue](https://github.com/kubernetes-sigs/cloud-provider-azure/issues?q=is:issue+is:open) when you hit one in your PR.

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->

Patch:
diff --git a/pkg/provider/azure.go b/pkg/provider/azure.go
index 83e1b73fc..f983ea077 100644
--- a/pkg/provider/azure.go
+++ b/pkg/provider/azure.go
@@ -349,7 +349,6 @@ var (
 	_ cloudprovider.LoadBalancer = (*Cloud)(nil)
 	_ cloudprovider.Routes       = (*Cloud)(nil)
 	_ cloudprovider.Zones        = (*Cloud)(nil)
-	_ cloudprovider.PVLabeler    = (*Cloud)(nil)
 )
 
 // Cloud holds the config and clients
@@ -441,8 +440,7 @@ type Cloud struct {
 	// node-sync-loop routine and service-reconcile routine should not update LoadBalancer at the same time
 	serviceReconcileLock sync.Mutex
 
-	*ManagedDiskController
-
+	lockMap *LockMap
 	// multipleStandardLoadBalancerConfigurationsSynced make sure the `reconcileMultipleStandardLoadBalancerConfigurations`
 	// runs only once every time the cloud provide restarts.
 	multipleStandardLoadBalancerConfigurationsSynced bool
@@ -473,7 +471,7 @@ func NewCloud(ctx context.Context, config *Config, callFromCCM bool) (cloudprovi
 	}
 
 	az.ipv6DualStackEnabled = true
-
+	az.lockMap = newLockMap()
 	return az, nil
 }
 
@@ -728,9 +726,6 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config,
 		return err
 	}
 
-	if err := InitDiskControllers(az); err != nil {
-		return err
-	}
 	// Common controller contains the function
 	// needed by both blob disk and managed disk controllers
 	qps := float32(ratelimitconfig.DefaultAtachDetachDiskQPS)
@@ -741,14 +736,6 @@ func (az *Cloud) InitializeCloudFromConfig(ctx context.Context, config *Config,
 	}
 	klog.V(2).Infof("attach/detach disk operation rate limit QPS: %f, Bucket: %d", qps, bucket)
 
-	common := &controllerCommon{
-		cloud:                        az,
-		lockMap:                      newLockMap(),
-		AttachDetachInitialDelayInMs: defaultAttachDetachInitialDelayInMs,
-	}
-
-	az.ManagedDiskController = &ManagedDiskController{common}
-
 	// updating routes and syncing zones only in CCM
 	if callFromCCM {
 		// start delayed route updater.
@@ -1173,29 +1160,6 @@ func (az *Cloud) ProviderName() string {
 	return consts.CloudProviderName
 }
 
-func InitDiskControllers(az *Cloud) error {
-	// Common controller contains the function
-	// needed by both blob disk and managed disk controllers
-
-	qps := float32(ratelimitconfig.DefaultAtachDetachDiskQPS)
-	bucket := ratelimitconfig.DefaultAtachDetachDiskBucket
-	if az.Config.AttachDetachDiskRateLimit != nil {
-		qps = az.Config.AttachDetachDiskRateLimit.CloudProviderRateLimitQPSWrite
-		bucket = az.Config.AttachDetachDiskRateLimit.CloudProviderRateLimitBucketWrite
-	}
-	klog.V(2).Infof("attach/detach disk operation rate limit QPS: %f, Bucket: %d", qps, bucket)
-
-	common := &controllerCommon{
-		cloud:                        az,
-		lockMap:                      newLockMap(),
-		AttachDetachInitialDelayInMs: defaultAttachDetachInitialDelayInMs,
-	}
-
-	az.ManagedDiskController = &ManagedDiskController{common}
-
-	return nil
-}
-
 // SetInformers sets informers for Azure cloud provider.
 func (az *Cloud) SetInformers(informerFactory informers.SharedInformerFactory) {
 	klog.Infof("Setting up informers for Azure cloud provider")
diff --git a/pkg/provider/azure_controller_common.go b/pkg/provider/azure_controller_common.go
index e1ba039a8..d4c966e85 100644
--- a/pkg/provider/azure_controller_common.go
+++ b/pkg/provider/azure_controller_common.go
@@ -18,35 +18,18 @@ package provider
 
 import (
 	"context"
-	"errors"
 	"fmt"
 	"net/http"
 	"path"
-	"regexp"
 	"strings"
-	"sync"
-	"time"
 
 	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute"
-	"github.com/Azure/go-autorest/autorest/azure"
-
-	"k8s.io/apimachinery/pkg/types"
-	kwait "k8s.io/apimachinery/pkg/util/wait"
-	cloudprovider "k8s.io/cloud-provider"
-	volerr "k8s.io/cloud-provider/volume/errors"
 	"k8s.io/klog/v2"
-	"k8s.io/utils/pointer"
 
-	azcache "sigs.k8s.io/cloud-provider-azure/pkg/cache"
-	"sigs.k8s.io/cloud-provider-azure/pkg/consts"
-	"sigs.k8s.io/cloud-provider-azure/pkg/retry"
+	"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/diskclient"
 )
 
 const (
-	// Disk Caching is not supported for disks 4 TiB and larger
-	// https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching
-	diskCachingLimit = 4096 // GiB
-
 	maxLUN                 = 64 // max number of LUNs per VM
 	errStatusCode400       = "statuscode=400"
 	errInvalidParameter    = `code="invalidparameter"`
@@ -56,68 +39,11 @@ const (
 	attachDiskMapKeySuffix = "attachdiskmap"
 	detachDiskMapKeySuffix = "detachdiskmap"
 
-	updateVMRetryDuration = time.Duration(1) * time.Second
-	updateVMRetryFactor   = 3.0
-	updateVMRetrySteps    = 5
-
-	// default initial delay in milliseconds for batch disk attach/detach
-	defaultAttachDetachInitialDelayInMs = 1000
-
 	// WriteAcceleratorEnabled support for Azure Write Accelerator on Azure Disks
 	// https://docs.microsoft.com/azure/virtual-machines/windows/how-to-enable-write-accelerator
 	WriteAcceleratorEnabled = "writeacceleratorenabled"
-
-	// see https://docs.microsoft.com/en-us/rest/api/compute/disks/createorupdate#create-a-managed-disk-by-copying-a-snapshot.
-	diskSnapshotPath = "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/snapshots/%s"
-
-	// see https://docs.microsoft.com/en-us/rest/api/compute/disks/createorupdate#create-a-managed-disk-from-an-existing-managed-disk-in-the-same-or-different-subscription.
-	managedDiskPath = "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s"
 )
 
-var defaultBackOff = kwait.Backoff{
-	Steps:    20,
-	Duration: 2 * time.Second,
-	Factor:   1.5,
-	Jitter:   0.0,
-}
-
-var updateVMBackoff = kwait.Backoff{
-	Duration: updateVMRetryDuration,
-	Factor:   updateVMRetryFactor,
-	Steps:    updateVMRetrySteps,
-}
-
-var (
-	managedDiskPathRE  = regexp.MustCompile(`.*/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/disks/(.+)`)
-	diskSnapshotPathRE = regexp.MustCompile(`.*/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/snapshots/(.+)`)
-	errorCodeRE        = regexp.MustCompile(`Code="(.*?)".*`)
-)
-
-type controllerCommon struct {
-	diskStateMap sync.Map // <diskURI, attaching/detaching state>
-	lockMap      *lockMap
-	cloud        *Cloud
-	// disk queue that is waiting for attach or detach on specific node
-	// <nodeName, map<diskURI, *AttachDiskOptions/DetachDiskOptions>>
-	attachDiskMap sync.Map
-	detachDiskMap sync.Map
-	// DisableUpdateCache whether disable update cache in disk attach/detach
-	DisableUpdateCache bool
-	// DisableDiskLunCheck whether disable disk lun check after disk attach/detach
-	DisableDiskLunCheck bool
-	// AttachDetachInitialDelayInMs determines initial delay in milliseconds for batch disk attach/detach
-	AttachDetachInitialDelayInMs int
-}
-
-// AttachDiskOptions attach disk options
-type AttachDiskOptions struct {
-	CachingMode             compute.CachingTypes
-	DiskName                string
-	DiskEncryptionSetID     string
-	WriteAcceleratorEnabled bool
-	Lun                     int32
-}
-
 // ExtendedLocation contains additional info about the location of resources.
 type ExtendedLocation struct {
 	// Name - The name of the extended location.
@@ -126,504 +52,13 @@ type ExtendedLocation struct {
 	Type string `json:"type,omitempty"`
 }
 
-// AttachDisk attaches a disk to vm
-// occupiedLuns is used to avoid conflict with other disk attach in k8s VolumeAttachments
-// return (lun, error)
-func (c *controllerCommon) AttachDisk(ctx context.Context, diskName, diskURI string, nodeName types.NodeName,
-	cachingMode compute.CachingTypes, disk *compute.Disk, occupiedLuns []int) (int32, error) {
-	diskEncryptionSetID := ""
-	writeAcceleratorEnabled := false
-
-	// there is possibility that disk is nil when GetDisk is throttled
-	// don't check disk state when GetDisk is throttled
-	if disk != nil {
-		if disk.ManagedBy != nil && (disk.MaxShares == nil || *disk.MaxShares <= 1) {
-			vmset, err := c.cloud.GetNodeVMSet(nodeName, azcache.CacheReadTypeUnsafe)
-			if err != nil {
-				return -1, err
-			}
-			attachedNode, err := vmset.GetNodeNameByProviderID(*disk.ManagedBy)
-			if err != nil {
-				return -1, err
-			}
-			if strings.EqualFold(string(nodeName), string(attachedNode)) {
-				klog.Warningf("volume %s is actually attached to current node %s, invalidate vm cache and return error", diskURI, nodeName)
-				// update VM(invalidate vm cache)
-				if errUpdate := c.UpdateVM(ctx, nodeName); errUpdate != nil {
-					return -1, errUpdate
-				}
-				lun, _, err := c.GetDiskLun(diskName, diskURI, nodeName)
-				return lun, err
-			}
-
-			attachErr := fmt.Sprintf(
-				"disk(%s) already attached to node(%s), could not be attached to node(%s)",
-				diskURI, *disk.ManagedBy, nodeName)
-			klog.V(2).Infof("found dangling volume %s attached to node %s, could not be attached to node(%s)", diskURI, attachedNode, nodeName)
-			return -1, volerr.NewDanglingError(attachErr, attachedNode, "")
-		}
-
-		if disk.DiskProperties != nil {
-			if disk.DiskProperties.DiskSizeGB != nil && *disk.DiskProperties.DiskSizeGB >= diskCachingLimit && cachingMode != compute.CachingTypesNone {
-				// Disk Caching is not supported for disks 4 TiB and larger
-				// https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching
-				cachingMode = compute.CachingTypesNone
-				klog.Warningf("size of disk(%s) is %dGB which is bigger than limit(%dGB), set cacheMode as None",
-					diskURI, *disk.DiskProperties.DiskSizeGB, diskCachingLimit)
-			}
-
-			if disk.DiskProperties.Encryption != nil &&
-				disk.DiskProperties.Encryption.DiskEncryptionSetID != nil {
-				diskEncryptionSetID = *disk.DiskProperties.Encryption.DiskEncryptionSetID
-			}
-
-			if disk.DiskProperties.DiskState != compute.Unattached && (disk.MaxShares == nil || *disk.MaxShares <= 1) {
-				return -1, fmt.Errorf("state of disk(%s) is %s, not in expected %s state", diskURI, disk.DiskProperties.DiskState, compute.Unattached)
-			}
-		}
-
-		if v, ok := disk.Tags[WriteAcceleratorEnabled]; ok {
-			if v != nil && strings.EqualFold(*v, "true") {
-				writeAcceleratorEnabled = true
-			}
-		}
-	}
-
-	options := AttachDiskOptions{
-		Lun:                     -1,
-		DiskName:                diskName,
-		CachingMode:             cachingMode,
-		DiskEncryptionSetID:     diskEncryptionSetID,
-		WriteAcceleratorEnabled: writeAcceleratorEnabled,
-	}
-	node := strings.ToLower(string(nodeName))
-	diskuri := strings.ToLower(diskURI)
-	requestNum, err := c.insertAttachDiskRequest(diskuri, node, &options)
-	if err != nil {
-		return -1, err
-	}
-
-	c.lockMap.LockEntry(node)
-	unlock := false
-	defer func() {
-		if !unlock {
-			c.lockMap.UnlockEntry(node)
-		}
-	}()
-
-	if c.AttachDetachInitialDelayInMs > 0 && requestNum == 1 {
-		klog.V(2).Infof("wait %dms for more requests on node %s, current disk attach: %s", c.AttachDetachInitialDelayInMs, node, diskURI)
-		time.Sleep(time.Duration(c.AttachDetachInitialDelayInMs) * time.Millisecond)
-	}
-
-	diskMap, err := c.cleanAttachDiskRequests(node)
-	if err != nil {
-		return -1, err
-	}
-
-	lun, err := c.SetDiskLun(nodeName, diskuri, diskMap, occupiedLuns)
-	if err != nil {
-		return -1, err
-	}
-
-	klog.V(2).Infof("Trying to attach volume %s lun %d to node %s, diskMap len:%d, %+v", diskURI, lun, nodeName, len(diskMap), diskMap)
-	if len(diskMap) == 0 {
-		if !c.DisableDiskLunCheck {
-			// always check disk lun after disk attach complete
-			diskLun, vmState, errGetLun := c.GetDiskLun(diskName, diskURI, nodeName)
-			if errGetLun != nil {
-				return -1, fmt.Errorf("disk(%s) could not be found on node(%s), vmState: %s, error: %w", diskURI, nodeName, pointer.StringDeref(vmState, ""), errGetLun)
-			}
-			lun = diskLun
-		}
-		return lun, nil
-	}
-
-	vmset, err := c.cloud.GetNodeVMSet(nodeName, azcache.CacheReadTypeUnsafe)
-	if err != nil {
-		return -1, err
-	}
-	c.diskStateMap.Store(disk, "attaching")
-	defer c.diskStateMap.Delete(disk)
-
-	defer func() {
-		// invalidate the cache if there is error in disk attach
-		if err != nil {
-			_ = vmset.DeleteCacheForNode(string(nodeName))
-		}
-	}()
-
-	var future *azure.Future
-	future, err = vmset.AttachDisk(ctx, nodeName, diskMap)
-	if err != nil {
-		return -1, err
-	}
-	// err will be handled by waitForUpdateResult below
-	if err = c.waitForUpdateResult(ctx, vmset, nodeName, future, err); err != nil {
-		return -1, err
-	}
-
-	if !c.DisableDiskLunCheck {
-		// always check disk lun after disk attach complete
-		diskLun, vmState, errGetLun := c.GetDiskLun(diskName, diskURI, nodeName)
-		if errGetLun != nil {
-			return -1, fmt.Errorf("disk(%s) could not be found on node(%s), vmState: %s, error: %w", diskURI, nodeName, pointer.StringDeref(vmState, ""), errGetLun)
-		}
-		lun = diskLun
-	}
-	return lun, nil
-}
-
-// waitForUpdateResult handles asynchronous VM update operations and retries with backoff if OperationPreempted error is observed
-func (c *controllerCommon) waitForUpdateResult(ctx context.Context, vmset VMSet, nodeName types.NodeName, future *azure.Future, updateErr error) (err error) {
-	err = updateErr
-	if err == nil {
-		err = vmset.WaitForUpdateResult(ctx, future, nodeName, "attach_disk")
-	}
-
-	if vmUpdateRequired(future, err) {
-		if derr := kwait.ExponentialBackoffWithContext(ctx, updateVMBackoff, func(ctx context.Context) (bool, error) {
-			klog.Errorf("Retry VM Update on node (%s) due to error (%v)", nodeName, err)
-			future, err = vmset.UpdateVMAsync(ctx, nodeName)
-			if err == nil {
-				err = vmset.WaitForUpdateResult(ctx, future, nodeName, "attach_disk")
-			}
-			return !vmUpdateRequired(future, err), nil
-		}); derr != nil {
-			err = derr
-			return
-		}
-	}
-
-	if err != nil && configAccepted(future) {
-		err = retry.NewPartialUpdateError(err.Error())
-	}
-	return
-}
-
-// insertAttachDiskRequest return (attachDiskRequestQueueLength, error)
-func (c *controllerCommon) insertAttachDiskRequest(diskURI, nodeName string, options *AttachDiskOptions) (int, error) {
-	var diskMap map[string]*AttachDiskOptions
-	attachDiskMapKey := nodeName + attachDiskMapKeySuffix
-	c.lockMap.LockEntry(attachDiskMapKey)
-	defer c.lockMap.UnlockEntry(attachDiskMapKey)
-	v, ok := c.attachDiskMap.Load(nodeName)
-	if ok {
-		if diskMap, ok = v.(map[string]*AttachDiskOptions); !ok {
-			return -1, fmt.Errorf("convert attachDiskMap failure on node(%s)", nodeName)
-		}
-	} else {
-		diskMap = make(map[string]*AttachDiskOptions)
-		c.attachDiskMap.Store(nodeName, diskMap)
-	}
-	// insert attach disk request to queue
-	_, ok = diskMap[diskURI]
-	if ok {
-		klog.V(2).Infof("azureDisk - duplicated attach disk(%s) request on node(%s)", diskURI, nodeName)
-	} else {
-		diskMap[diskURI] = options
-	}
-	return len(diskMap), nil
-}
-
-// clean up attach disk requests
-// return original attach disk requests
-func (c *controllerCommon) cleanAttachDiskRequests(nodeName string) (map[string]*AttachDiskOptions, error) {
-	var diskMap map[string]*AttachDiskOptions
-
-	attachDiskMapKey := nodeName + attachDiskMapKeySuffix
-	c.lockMap.LockEntry(attachDiskMapKey)
-	defer c.lockMap.UnlockEntry(attachDiskMapKey)
-	v, ok := c.attachDiskMap.Load(nodeName)
-	if !ok {
-		return diskMap, nil
-	}
-	if diskMap, ok = v.(map[string]*AttachDiskOptions); !ok {
-		return diskMap, fmt.Errorf("convert attachDiskMap failure on node(%s)", nodeName)
-	}
-	c.attachDiskMap.Store(nodeName, make(map[string]*AttachDiskOptions))
-	return diskMap, nil
-}
-
-// DetachDisk detaches a disk from VM
-func (c *controllerCommon) DetachDisk(ctx context.Context, diskName, diskURI string, nodeName types.NodeName) error {
-	if _, err := c.cloud.InstanceID(ctx, nodeName); err != nil {
-		if errors.Is(err, cloudprovider.InstanceNotFound) {
-			// if host doesn't exist, no need to detach
-			klog.Warningf("azureDisk - failed to get azure instance id(%s), DetachDisk(%s) will assume disk is already detached",
-				nodeName, diskURI)
-			return nil
-		}
-		klog.Warningf("failed to get azure instance id (%v)", err)
-		return fmt.Errorf("failed to get azure instance id for node %q: %w", nodeName, err)
-	}
-
-	vmset, err := c.cloud.GetNodeVMSet(nodeName, azcache.CacheReadTypeUnsafe)
-	if err != nil {
-		return err
-	}
-
-	node := strings.ToLower(string(nodeName))
-	disk := strings.ToLower(diskURI)
-	requestNum, err := c.insertDetachDiskRequest(diskName, disk, node)
-	if err != nil {
-		return err
-	}
-
-	c.lockMap.LockEntry(node)
-	defer c.lockMap.UnlockEntry(node)
-
-	if c.AttachDetachInitialDelayInMs > 0 && requestNum == 1 {
-		klog.V(2).Infof("wait %dms for more requests on node %s, current disk detach: %s", c.AttachDetachInitialDelayInMs, node, diskURI)
-		time.Sleep(time.Duration(c.AttachDetachInitialDelayInMs) * time.Millisecond)
-	}
-	diskMap, err := c.cleanDetachDiskRequests(node)
-	if err != nil {
-		return err
-	}
-
-	klog.V(2).Infof("Trying to detach volume %s from node %s, diskMap len:%d, %s", diskURI, nodeName, len(diskMap), diskMap)
-	if len(diskMap) > 0 {
-		c.diskStateMap.Store(disk, "detaching")
-		defer c.diskStateMap.Delete(disk)
-		if err = vmset.DetachDisk(ctx, nodeName, diskMap); err != nil {
-			if isInstanceNotFoundError(err) {
-				// if host doesn't exist, no need to detach
-				klog.Warningf("azureDisk - got InstanceNotFoundError(%v), DetachDisk(%s) will assume disk is already detached",
-					err, diskURI)
-				return nil
-			}
-		}
-	}
-
-	if err != nil {
-		klog.Errorf("azureDisk - detach disk(%s, %s) failed, err: %v", diskName, diskURI, err)
-		return err
-	}
-
-	if !c.DisableDiskLunCheck {
-		// always check disk lun after disk detach complete
-		lun, vmState, errGetLun := c.GetDiskLun(diskName, diskURI, nodeName)
-		if errGetLun == nil || !strings.Contains(errGetLun.Error(), consts.CannotFindDiskLUN) {
-			return fmt.Errorf("disk(%s) is still attached to node(%s) on lun(%d), vmState: %s, error: %w", diskURI, nodeName, lun, pointer.StringDeref(vmState, ""), errGetLun)
-		}
-	}
-
-	klog.V(2).Infof("azureDisk - detach disk(%s, %s) succeeded", diskName, diskURI)
-	return nil
-}
-
-// UpdateVM updates a vm
-func (c *controllerCommon) UpdateVM(ctx context.Context, nodeName types.NodeName) error {
-	vmset, err := c.cloud.GetNodeVMSet(nodeName, azcache.CacheReadTypeUnsafe)
-	if err != nil {
-		return err
-	}
-	node := strings.ToLower(string(nodeName))
-	c.lockMap.LockEntry(node)
-	defer c.lockMap.UnlockEntry(node)
-
-	defer func() {
-		_ = vmset.DeleteCacheForNode(string(nodeName))
-	}()
-
-	klog.V(2).Infof("azureDisk - update: vm(%s)", nodeName)
-	return vmset.UpdateVM(ctx, nodeName)
-}
-
-// insertDetachDiskRequest return (detachDiskRequestQueueLength, error)
-func (c *controllerCommon) insertDetachDiskRequest(diskName, diskURI, nodeName string) (int, error) {
-	var diskMap map[string]string
-	detachDiskMapKey := nodeName + detachDiskMapKeySuffix
-	c.lockMap.LockEntry(detachDiskMapKey)
-	defer c.lockMap.UnlockEntry(detachDiskMapKey)
-	v, ok := c.detachDiskMap.Load(nodeName)
-	if ok {
-		if diskMap, ok = v.(map[string]string); !ok {
-			return -1, fmt.Errorf("convert detachDiskMap failure on node(%s)", nodeName)
-		}
-	} else {
-		diskMap = make(map[string]string)
-		c.detachDiskMap.Store(nodeName, diskMap)
-	}
-	// insert detach disk request to queue
-	_, ok = diskMap[diskURI]
-	if ok {
-		klog.V(2).Infof("azureDisk - duplicated detach disk(%s) request on node(%s)", diskURI, nodeName)
-	} else {
-		diskMap[diskURI] = diskName
-	}
-	return len(diskMap), nil
-}
-
-// clean up detach disk requests
-// return original detach disk requests
-func (c *controllerCommon) cleanDetachDiskRequests(nodeName string) (map[string]string, error) {
-	var diskMap map[string]string
-
-	detachDiskMapKey := nodeName + detachDiskMapKeySuffix
-	c.lockMap.LockEntry(detachDiskMapKey)
-	defer c.lockMap.UnlockEntry(detachDiskMapKey)
-	v, ok := c.detachDiskMap.Load(nodeName)
-	if !ok {
-		return diskMap, nil
-	}
-	if diskMap, ok = v.(map[string]string); !ok {
-		return diskMap, fmt.Errorf("convert detachDiskMap failure on node(%s)", nodeName)
-	}
-	// clean up original requests in disk map
-	c.detachDiskMap.Store(nodeName, make(map[string]string))
-	return diskMap, nil
-}
-
-// GetNodeDataDisks invokes vmSet interfaces to get data disks for the node.
-func (c *controllerCommon) GetNodeDataDisks(nodeName types.NodeName, crt azcache.AzureCacheReadType) ([]compute.DataDisk, *string, error) {
-	vmset, err := c.cloud.GetNodeVMSet(nodeName, crt)
-	if err != nil {
-		return nil, nil, err
-	}
-
-	return vmset.GetDataDisks(nodeName, crt)
-}
-
-// GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI.
-func (c *controllerCommon) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, *string, error) {
-	// GetNodeDataDisks need to fetch the cached data/fresh data if cache expired here
-	// to ensure we get LUN based on latest entry.
-	disks, provisioningState, err := c.GetNodeDataDisks(nodeName, azcache.CacheReadTypeDefault)
-	if err != nil {
-		klog.Errorf("error of getting data disks for node %s: %v", nodeName, err)
-		return -1, provisioningState, err
-	}
-
-	for _, disk := range disks {
-		if disk.Lun != nil && (disk.Name != nil && diskName != "" && strings.EqualFold(*disk.Name, diskName)) ||
-			(disk.Vhd != nil && disk.Vhd.URI != nil && diskURI != "" && strings.EqualFold(*disk.Vhd.URI, diskURI)) ||
-			(disk.ManagedDisk != nil && strings.EqualFold(*disk.ManagedDisk.ID, diskURI)) {
-			if disk.ToBeDetached != nil && *disk.ToBeDetached {
-				klog.Warningf("azureDisk - find disk(ToBeDetached): lun %d name %s uri %s", *disk.Lun, diskName, diskURI)
-			} else {
-				// found the disk
-				klog.V(2).Infof("azureDisk - find disk: lun %d name %s uri %s", *disk.Lun, diskName, diskURI)
-				return *disk.Lun, provisioningState, nil
-			}
-		}
-	}
-	return -1, provisioningState, fmt.Errorf("%s for disk %s", consts.CannotFindDiskLUN, diskName)
-}
-
-// SetDiskLun find unused luns and allocate lun for every disk in diskMap.
-// occupiedLuns is used to avoid conflict with other disk attach in k8s VolumeAttachments
-// Return lun of diskURI, -1 if all luns are used.
-func (c *controllerCommon) SetDiskLun(nodeName types.NodeName, diskURI string, diskMap map[string]*AttachDiskOptions, occupiedLuns []int) (int32, error) {
-	disks, _, err := c.GetNodeDataDisks(nodeName, azcache.CacheReadTypeDefault)
-	if err != nil {
-		klog.Errorf("error of getting data disks for node %s: %v", nodeName, err)
-		return -1, err
-	}
-
-	lun := int32(-1)
-	_, isDiskInMap := diskMap[diskURI]
-	used := make([]bool, maxLUN)
-	for _, disk := range disks {
-		if disk.Lun != nil {
-			used[*disk.Lun] = true
-			if !isDiskInMap {
-				// find lun of diskURI since diskURI is not in diskMap
-				if disk.ManagedDisk != nil && strings.EqualFold(*disk.ManagedDisk.ID, diskURI) {
-					lun = *disk.Lun
-				}
-			}
-		}
-	}
-	if !isDiskInMap && lun < 0 {
-		return -1, fmt.Errorf("could not find disk(%s) in current disk list(len: %d) nor in diskMap(%v)", diskURI, len(disks), diskMap)
-	}
-	if len(diskMap) == 0 {
-		// attach disk request is empty, return directly
-		return lun, nil
-	}
-
-	for _, lun := range occupiedLuns {
-		used[int32(lun)] = true
-	}
-
-	// allocate lun for every disk in diskMap
-	var diskLuns []int32
-	count := 0
-	for k, v := range used {
-		if !v {
-			diskLuns = append(diskLuns, int32(k))
-			count++
-			if count >= len(diskMap) {
-				break
-			}
-		}
-	}
-
-	if len(diskLuns) != len(diskMap) {
-		return -1, fmt.Errorf("could not find enough disk luns(current: %d) for diskMap(%v, len=%d), diskURI(%s)",
-			len(diskLuns), diskMap, len(diskMap), diskURI)
-	}
-
-	count = 0
-	for uri, opt := range diskMap {
-		if opt == nil {
-			return -1, fmt.Errorf("unexpected nil pointer in diskMap(%v), diskURI(%s)", diskMap, diskURI)
-		}
-		if strings.EqualFold(uri, diskURI) {
-			lun = diskLuns[count]
-		}
-		opt.Lun = diskLuns[count]
-		count++
-	}
-	if lun < 0 {
-		return lun, fmt.Errorf("could not find lun of diskURI(%s), diskMap(%v)", diskURI, diskMap)
-	}
-	return lun, nil
-}
-
-// DisksAreAttached checks if a list of volumes are attached to the node with the specified NodeName.
-func (c *controllerCommon) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error) {
-	attached := make(map[string]bool)
-	for _, diskName := range diskNames {
-		attached[diskName] = false
-	}
-
-	// doing stalled read for GetNodeDataDisks to ensure we don't call ARM
-	// for every reconcile call. The cache is invalidated after Attach/Detach
-	// disk. So the new entry will be fetched and cached the first time reconcile
-	// loop runs after the Attach/Disk OP which will reflect the latest model.
-	disks, _, err := c.GetNodeDataDisks(nodeName, azcache.CacheReadTypeUnsafe)
-	if err != nil {
-		if errors.Is(err, cloudprovider.InstanceNotFound) {
-			// if host doesn't exist, no need to detach
-			klog.Warningf("azureDisk - Cannot find node %s, DisksAreAttached will assume disks %v are not attached to it.",
-				nodeName, diskNames)
-			return attached, nil
-		}
-
-		return attached, err
-	}
-
-	for _, disk := range disks {
-		for _, diskName := range diskNames {
-			if disk.Name != nil && diskName != "" && strings.EqualFold(*disk.Name, diskName) {
-				attached[diskName] = true
-			}
-		}
-	}
-
-	return attached, nil
-}
-
-func (c *controllerCommon) filterNonExistingDisks(ctx context.Context, unfilteredDisks []compute.DataDisk) []compute.DataDisk {
+func FilterNonExistingDisks(ctx context.Context, diskClient diskclient.Interface, unfilteredDisks []compute.DataDisk) []compute.DataDisk {
 	filteredDisks := []compute.DataDisk{}
 	for _, disk := range unfilteredDisks {
 		filter := false
 		if disk.ManagedDisk != nil && disk.ManagedDisk.ID != nil {
 			diskURI := *disk.ManagedDisk.ID
-			exist, err := c.cloud.checkDiskExists(ctx, diskURI)
+			exist, err := checkDiskExists(ctx, diskClient, diskURI)
 			if err != nil {
 				klog.Errorf("checkDiskExists(%s) failed with error: %v", diskURI, err)
 			} else {
@@ -642,14 +77,14 @@ func (c *controllerCommon) filterNonExistingDisks(ctx context.Context, unfiltere
 	return filteredDisks
 }
 
-func (c *controllerCommon) checkDiskExists(ctx context.Context, diskURI string) (bool, error) {
+func checkDiskExists(ctx context.Context, diskClient diskclient.Interface, diskURI string) (bool, error) {
 	diskName := path.Base(diskURI)
 	resourceGroup, subsID, err := getInfoFromDiskURI(diskURI)
 	if err != nil {
 		return false, err
 	}
 
-	if _, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName); rerr != nil {
+	if _, rerr := diskClient.Get(ctx, subsID, resourceGroup, diskName); rerr != nil {
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			return false, nil
 		}
@@ -659,73 +94,13 @@ func (c *controllerCommon) checkDiskExists(ctx context.Context, diskURI string)
 	return true, nil
 }
 
-func vmUpdateRequired(future *azure.Future, err error) bool {
-	errCode := getAzureErrorCode(err)
-	return configAccepted(future) && errCode == consts.OperationPreemptedErrorCode
-}
-
-func getValidCreationData(subscriptionID, resourceGroup string, options *ManagedDiskOptions) (compute.CreationData, error) {
-	if options.SourceResourceID == "" {
-		return compute.CreationData{
-			CreateOption:    compute.Empty,
-			PerformancePlus: options.PerformancePlus,
-		}, nil
-	}
-
-	sourceResourceID := options.SourceResourceID
-	switch options.SourceType {
-	case sourceSnapshot:
-		if match := diskSnapshotPathRE.FindString(sourceResourceID); match == "" {
-			sourceResourceID = fmt.Sprintf(diskSnapshotPath, subscriptionID, resourceGroup, sourceResourceID)
-		}
-
-	case sourceVolume:
-		if match := managedDiskPathRE.FindString(sourceResourceID); match == "" {
-			sourceResourceID = fmt.Sprintf(managedDiskPath, subscriptionID, resourceGroup, sourceResourceID)
-		}
-	default:
-		return compute.CreationData{
-			CreateOption:    compute.Empty,
-			PerformancePlus: options.PerformancePlus,
-		}, nil
-	}
-
-	splits := strings.Split(sourceResourceID, "/")
-	if len(splits) > 9 {
-		if options.SourceType == sourceSnapshot {
-			return compute.CreationData{}, fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", sourceResourceID, diskSnapshotPathRE)
-		}
-		return compute.CreationData{}, fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", sourceResourceID, managedDiskPathRE)
-	}
-	return compute.CreationData{
-		CreateOption:     compute.Copy,
-		SourceResourceID: &sourceResourceID,
-		PerformancePlus:  options.PerformancePlus,
-	}, nil
-}
-
-func isInstanceNotFoundError(err error) bool {
-	errMsg := strings.ToLower(err.Error())
-	if strings.Contains(errMsg, strings.ToLower(consts.VmssVMNotActiveErrorMessage)) {
-		return true
+// get resource group name, subs id from a managed disk URI, e.g. return {group-name}, {sub-id} according to
+// /subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}
+// according to https://docs.microsoft.com/en-us/rest/api/compute/disks/get
+func getInfoFromDiskURI(diskURI string) (string, string, error) {
+	fields := strings.Split(diskURI, "/")
+	if len(fields) != 9 || strings.ToLower(fields[3]) != "resourcegroups" {
+		return "", "", fmt.Errorf("invalid disk URI: %s", diskURI)
 	}
-	return strings.Contains(errMsg, errStatusCode400) && strings.Contains(errMsg, errInvalidParameter) && strings.Contains(errMsg, errTargetInstanceIds)
-}
-
-// getAzureErrorCode uses regex to parse out the error code encapsulated in the error string.
-func getAzureErrorCode(err error) string {
-	if err == nil {
-		return ""
-	}
-	matches := errorCodeRE.FindStringSubmatch(err.Error())
-	if matches == nil {
-		return ""
-	}
-	return matches[1]
-}
-
-// configAccepted returns true if storage profile change had been committed (i.e. HTTP status code == 2xx) and returns false otherwise.
-func configAccepted(future *azure.Future) bool {
-	// if status code indicates success, the storage profile change was committed
-	return future != nil && future.Response() != nil && future.Response().StatusCode/100 == 2
+	return fields[4], fields[2], nil
 }
diff --git a/pkg/provider/azure_controller_standard.go b/pkg/provider/azure_controller_standard.go
index 229e061b5..2e5bdbc75 100644
--- a/pkg/provider/azure_controller_standard.go
+++ b/pkg/provider/azure_controller_standard.go
@@ -106,7 +106,7 @@ func (as *availabilitySet) AttachDisk(ctx context.Context, nodeName types.NodeNa
 		klog.Errorf("azureDisk - attach disk list(%v) on rg(%s) vm(%s) failed, err: %+v", diskMap, nodeResourceGroup, vmName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, vmName)
-			disks := as.filterNonExistingDisks(ctx, *newVM.VirtualMachineProperties.StorageProfile.DataDisks)
+			disks := FilterNonExistingDisks(ctx, as.DisksClient, *newVM.VirtualMachineProperties.StorageProfile.DataDisks)
 			newVM.VirtualMachineProperties.StorageProfile.DataDisks = &disks
 			future, rerr = as.VirtualMachinesClient.UpdateAsync(ctx, nodeResourceGroup, vmName, newVM, "attach_disk")
 		}
@@ -120,7 +120,7 @@ func (as *availabilitySet) AttachDisk(ctx context.Context, nodeName types.NodeNa
 }
 
 func (as *availabilitySet) DeleteCacheForNode(nodeName string) error {
-	err := as.cloud.vmCache.Delete(nodeName)
+	err := as.vmCache.Delete(nodeName)
 	if err == nil {
 		klog.V(2).Infof("DeleteCacheForNode(%s) successfully", nodeName)
 	} else {
@@ -187,7 +187,7 @@ func (as *availabilitySet) DetachDisk(ctx context.Context, nodeName types.NodeNa
 		// only log here, next action is to update VM status with original meta data
 		klog.Warningf("detach azure disk on node(%s): disk list(%s) not found", nodeName, diskMap)
 	} else {
-		if strings.EqualFold(as.cloud.Environment.Name, consts.AzureStackCloudName) && !as.Config.DisableAzureStackCloud {
+		if strings.EqualFold(as.Environment.Name, consts.AzureStackCloudName) && !as.Config.DisableAzureStackCloud {
 			// Azure stack does not support ToBeDetached flag, use original way to detach disk
 			newDisks := []compute.DataDisk{}
 			for _, disk := range disks {
@@ -226,7 +226,7 @@ func (as *availabilitySet) DetachDisk(ctx context.Context, nodeName types.NodeNa
 		klog.Errorf("azureDisk - detach disk list(%s) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, vmName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, vmName)
-			disks := as.filterNonExistingDisks(ctx, *vm.StorageProfile.DataDisks)
+			disks := FilterNonExistingDisks(ctx, as.DisksClient, *vm.StorageProfile.DataDisks)
 			newVM.VirtualMachineProperties.StorageProfile.DataDisks = &disks
 			result, rerr = as.VirtualMachinesClient.Update(ctx, nodeResourceGroup, vmName, newVM, "detach_disk")
 		}
@@ -264,10 +264,7 @@ func (as *availabilitySet) UpdateVMAsync(ctx context.Context, nodeName types.Nod
 }
 
 func (as *availabilitySet) updateCache(nodeName string, vm *compute.VirtualMachine) {
-	if as.ManagedDiskController.DisableUpdateCache {
-		return
-	}
-	as.cloud.vmCache.Update(nodeName, vm)
+	as.vmCache.Update(nodeName, vm)
 	klog.V(2).Infof("updateCache(%s) successfully", nodeName)
 }
 
diff --git a/pkg/provider/azure_controller_vmss.go b/pkg/provider/azure_controller_vmss.go
index 650c13f62..2ea827a61 100644
--- a/pkg/provider/azure_controller_vmss.go
+++ b/pkg/provider/azure_controller_vmss.go
@@ -113,7 +113,7 @@ func (ss *ScaleSet) AttachDisk(ctx context.Context, nodeName types.NodeName, dis
 		klog.Errorf("azureDisk - attach disk list(%+v) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, nodeName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, nodeName)
-			disks := ss.filterNonExistingDisks(ctx, *newVM.VirtualMachineScaleSetVMProperties.StorageProfile.DataDisks)
+			disks := FilterNonExistingDisks(ctx, ss.DisksClient, *newVM.VirtualMachineScaleSetVMProperties.StorageProfile.DataDisks)
 			newVM.VirtualMachineScaleSetVMProperties.StorageProfile.DataDisks = &disks
 			future, rerr = ss.VirtualMachineScaleSetVMsClient.UpdateAsync(ctx, nodeResourceGroup, vm.VMSSName, vm.InstanceID, newVM, "attach_disk")
 		}
@@ -201,7 +201,7 @@ func (ss *ScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName, dis
 		// only log here, next action is to update VM status with original meta data
 		klog.Warningf("detach azure disk on node(%s): disk list(%s) not found", nodeName, diskMap)
 	} else {
-		if strings.EqualFold(ss.cloud.Environment.Name, consts.AzureStackCloudName) && !ss.Config.DisableAzureStackCloud {
+		if strings.EqualFold(ss.Environment.Name, consts.AzureStackCloudName) && !ss.Config.DisableAzureStackCloud {
 			// Azure stack does not support ToBeDetached flag, use original way to detach disk
 			var newDisks []compute.DataDisk
 			for _, disk := range disks {
@@ -243,7 +243,7 @@ func (ss *ScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName, dis
 		klog.Errorf("azureDisk - detach disk list(%s) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, nodeName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, nodeName)
-			disks := ss.filterNonExistingDisks(ctx, *newVM.VirtualMachineScaleSetVMProperties.StorageProfile.DataDisks)
+			disks := FilterNonExistingDisks(ctx, ss.DisksClient, *newVM.VirtualMachineScaleSetVMProperties.StorageProfile.DataDisks)
 			newVM.VirtualMachineScaleSetVMProperties.StorageProfile.DataDisks = &disks
 			result, rerr = ss.VirtualMachineScaleSetVMsClient.Update(ctx, nodeResourceGroup, vm.VMSSName, vm.InstanceID, newVM, "detach_disk")
 		}
diff --git a/pkg/provider/azure_controller_vmssflex.go b/pkg/provider/azure_controller_vmssflex.go
index 9fa834934..b55c0ca31 100644
--- a/pkg/provider/azure_controller_vmssflex.go
+++ b/pkg/provider/azure_controller_vmssflex.go
@@ -107,7 +107,7 @@ func (fs *FlexScaleSet) AttachDisk(ctx context.Context, nodeName types.NodeName,
 		klog.Errorf("azureDisk - attach disk list(%+v) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, vmName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, vmName)
-			disks := fs.filterNonExistingDisks(ctx, *newVM.VirtualMachineProperties.StorageProfile.DataDisks)
+			disks := FilterNonExistingDisks(ctx, fs.DisksClient, *newVM.VirtualMachineProperties.StorageProfile.DataDisks)
 			newVM.VirtualMachineProperties.StorageProfile.DataDisks = &disks
 			future, rerr = fs.VirtualMachinesClient.UpdateAsync(ctx, nodeResourceGroup, *vm.Name, newVM, "attach_disk")
 		}
@@ -156,7 +156,7 @@ func (fs *FlexScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName,
 		// only log here, next action is to update VM status with original meta data
 		klog.Warningf("detach azure disk on node(%s): disk list(%s) not found", nodeName, diskMap)
 	} else {
-		if strings.EqualFold(fs.cloud.Environment.Name, consts.AzureStackCloudName) && !fs.Config.DisableAzureStackCloud {
+		if strings.EqualFold(fs.Environment.Name, consts.AzureStackCloudName) && !fs.Config.DisableAzureStackCloud {
 			// Azure stack does not support ToBeDetached flag, use original way to detach disk
 			newDisks := []compute.DataDisk{}
 			for _, disk := range disks {
@@ -197,7 +197,7 @@ func (fs *FlexScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName,
 		klog.Errorf("azureDisk - detach disk list(%s) on rg(%s) vm(%s) failed, err: %v", diskMap, nodeResourceGroup, vmName, rerr)
 		if rerr.HTTPStatusCode == http.StatusNotFound {
 			klog.Errorf("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)", diskMap, nodeResourceGroup, vmName)
-			disks := fs.filterNonExistingDisks(ctx, *vm.StorageProfile.DataDisks)
+			disks := FilterNonExistingDisks(ctx, fs.DisksClient, *vm.StorageProfile.DataDisks)
 			newVM.VirtualMachineProperties.StorageProfile.DataDisks = &disks
 			result, rerr = fs.VirtualMachinesClient.Update(ctx, nodeResourceGroup, *vm.Name, newVM, "detach_disk")
 		}
@@ -263,9 +263,6 @@ func (fs *FlexScaleSet) UpdateVMAsync(ctx context.Context, nodeName types.NodeNa
 }
 
 func (fs *FlexScaleSet) updateCache(nodeName string, vm *compute.VirtualMachine) error {
-	if fs.ManagedDiskController.DisableUpdateCache {
-		return nil
-	}
 	if vm == nil {
 		return fmt.Errorf("vm is nil")
 	}
diff --git a/pkg/provider/azure_fakes.go b/pkg/provider/azure_fakes.go
index 8ba4ac31a..451609d3e 100644
--- a/pkg/provider/azure_fakes.go
+++ b/pkg/provider/azure_fakes.go
@@ -104,6 +104,7 @@ func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) {
 		nodePrivateIPs:           map[string]sets.Set[string]{},
 		routeCIDRs:               map[string]string{},
 		eventRecorder:            &record.FakeRecorder{},
+		lockMap:                  newLockMap(),
 	}
 	az.DisksClient = mockdiskclient.NewMockInterface(ctrl)
 	az.SnapshotsClient = mocksnapshotclient.NewMockInterface(ctrl)
@@ -129,8 +130,6 @@ func GetTestCloud(ctrl *gomock.Controller) (az *Cloud) {
 	az.LoadBalancerBackendPool = NewMockBackendPool(ctrl)
 	az.storageAccountCache, _ = az.newStorageAccountCache()
 
-	_ = InitDiskControllers(az)
-
 	az.regionZonesMap = map[string][]string{az.Location: {"1", "2", "3"}}
 
 	return az
diff --git a/pkg/provider/azure_managedDiskController.go b/pkg/provider/azure_managedDiskController.go
deleted file mode 100644
index 206be6034..000000000
--- a/pkg/provider/azure_managedDiskController.go
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
-Copyright 2020 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
-	"context"
-	"fmt"
-	"net/http"
-	"path"
-	"strconv"
-	"strings"
-
-	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute"
-
-	v1 "k8s.io/api/core/v1"
-	"k8s.io/apimachinery/pkg/api/resource"
-	kwait "k8s.io/apimachinery/pkg/util/wait"
-	cloudprovider "k8s.io/cloud-provider"
-	cloudvolume "k8s.io/cloud-provider/volume"
-	volumehelpers "k8s.io/cloud-provider/volume/helpers"
-	"k8s.io/klog/v2"
-	"k8s.io/utils/pointer"
-
-	"sigs.k8s.io/cloud-provider-azure/pkg/consts"
-)
-
-var _ cloudprovider.PVLabeler = (*Cloud)(nil)
-
-// ManagedDiskController : managed disk controller struct
-type ManagedDiskController struct {
-	*controllerCommon
-}
-
-// ManagedDiskOptions specifies the options of managed disks.
-type ManagedDiskOptions struct {
-	// The SKU of storage account.
-	StorageAccountType compute.DiskStorageAccountTypes
-	// The name of the disk.
-	DiskName string
-	// The name of PVC.
-	PVCName string
-	// The name of resource group.
-	ResourceGroup string
-	// The AvailabilityZone to create the disk.
-	AvailabilityZone string
-	// The tags of the disk.
-	Tags map[string]string
-	// IOPS Caps for UltraSSD disk
-	DiskIOPSReadWrite string
-	// Throughput Cap (MBps) for UltraSSD disk
-	DiskMBpsReadWrite string
-	// if SourceResourceID is not empty, then it's a disk copy operation(for snapshot)
-	SourceResourceID string
-	// The type of source
-	SourceType string
-	// ResourceId of the disk encryption set to use for enabling encryption at rest.
-	DiskEncryptionSetID string
-	// DiskEncryption type, available values: EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys
-	DiskEncryptionType string
-	// The size in GB.
-	SizeGB int
-	// The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.
-	MaxShares int32
-	// Logical sector size in bytes for Ultra disks
-	LogicalSectorSize int32
-	// SkipGetDiskOperation indicates whether skip GetDisk operation(mainly due to throttling)
-	SkipGetDiskOperation bool
-	// PublicNetworkAccess - Possible values include: 'Enabled', 'Disabled'
-	PublicNetworkAccess compute.PublicNetworkAccess
-	// NetworkAccessPolicy - Possible values include: 'AllowAll', 'AllowPrivate', 'DenyAll'
-	NetworkAccessPolicy compute.NetworkAccessPolicy
-	// DiskAccessID - ARM id of the DiskAccess resource for using private endpoints on disks.
-	DiskAccessID *string
-	// BurstingEnabled - Set to true to enable bursting beyond the provisioned performance target of the disk.
-	BurstingEnabled *bool
-	// SubscriptionID - specify a different SubscriptionID
-	SubscriptionID string
-	// Location - specify a different location
-	Location string
-	// PerformancePlus - Set this flag to true to get a boost on the performance target of the disk deployed
-	PerformancePlus *bool
-}
-
-// CreateManagedDisk: create managed disk
-func (c *ManagedDiskController) CreateManagedDisk(ctx context.Context, options *ManagedDiskOptions) (string, error) {
-	var err error
-	klog.V(4).Infof("azureDisk - creating new managed Name:%s StorageAccountType:%s Size:%v", options.DiskName, options.StorageAccountType, options.SizeGB)
-
-	var createZones []string
-	if len(options.AvailabilityZone) > 0 {
-		requestedZone := c.cloud.GetZoneID(options.AvailabilityZone)
-		if requestedZone != "" {
-			createZones = append(createZones, requestedZone)
-		}
-	}
-
-	// insert original tags to newTags
-	newTags := make(map[string]*string)
-	azureDDTag := "kubernetes-azure-dd"
-	newTags[consts.CreatedByTag] = &azureDDTag
-	if options.Tags != nil {
-		for k, v := range options.Tags {
-			// Azure won't allow / (forward slash) in tags
-			newKey := strings.Replace(k, "/", "-", -1)
-			newValue := strings.Replace(v, "/", "-", -1)
-			newTags[newKey] = &newValue
-		}
-	}
-
-	diskSizeGB := int32(options.SizeGB)
-	diskSku := options.StorageAccountType
-
-	rg := c.cloud.ResourceGroup
-	if options.ResourceGroup != "" {
-		rg = options.ResourceGroup
-	}
-	if options.SubscriptionID != "" && !strings.EqualFold(options.SubscriptionID, c.cloud.SubscriptionID) && options.ResourceGroup == "" {
-		return "", fmt.Errorf("resourceGroup must be specified when subscriptionID(%s) is not empty", options.SubscriptionID)
-	}
-	subsID := c.cloud.SubscriptionID
-	if options.SubscriptionID != "" {
-		subsID = options.SubscriptionID
-	}
-
-	creationData, err := getValidCreationData(subsID, rg, options)
-	if err != nil {
-		return "", err
-	}
-	diskProperties := compute.DiskProperties{
-		DiskSizeGB:      &diskSizeGB,
-		CreationData:    &creationData,
-		BurstingEnabled: options.BurstingEnabled,
-	}
-
-	if options.PublicNetworkAccess != "" {
-		diskProperties.PublicNetworkAccess = options.PublicNetworkAccess
-	}
-
-	if options.NetworkAccessPolicy != "" {
-		diskProperties.NetworkAccessPolicy = options.NetworkAccessPolicy
-		if options.NetworkAccessPolicy == compute.AllowPrivate {
-			if options.DiskAccessID == nil {
-				return "", fmt.Errorf("DiskAccessID should not be empty when NetworkAccessPolicy is AllowPrivate")
-			}
-			diskProperties.DiskAccessID = options.DiskAccessID
-		} else {
-			if options.DiskAccessID != nil {
-				return "", fmt.Errorf("DiskAccessID(%s) must be empty when NetworkAccessPolicy(%s) is not AllowPrivate", *options.DiskAccessID, options.NetworkAccessPolicy)
-			}
-		}
-	}
-
-	if diskSku == compute.UltraSSDLRS || diskSku == compute.PremiumV2LRS {
-		if options.DiskIOPSReadWrite == "" {
-			if diskSku == compute.UltraSSDLRS {
-				diskIOPSReadWrite := int64(consts.DefaultDiskIOPSReadWrite)
-				diskProperties.DiskIOPSReadWrite = pointer.Int64(diskIOPSReadWrite)
-			}
-		} else {
-			v, err := strconv.Atoi(options.DiskIOPSReadWrite)
-			if err != nil {
-				return "", fmt.Errorf("AzureDisk - failed to parse DiskIOPSReadWrite: %w", err)
-			}
-			diskIOPSReadWrite := int64(v)
-			diskProperties.DiskIOPSReadWrite = pointer.Int64(diskIOPSReadWrite)
-		}
-
-		if options.DiskMBpsReadWrite == "" {
-			if diskSku == compute.UltraSSDLRS {
-				diskMBpsReadWrite := int64(consts.DefaultDiskMBpsReadWrite)
-				diskProperties.DiskMBpsReadWrite = pointer.Int64(diskMBpsReadWrite)
-			}
-		} else {
-			v, err := strconv.Atoi(options.DiskMBpsReadWrite)
-			if err != nil {
-				return "", fmt.Errorf("AzureDisk - failed to parse DiskMBpsReadWrite: %w", err)
-			}
-			diskMBpsReadWrite := int64(v)
-			diskProperties.DiskMBpsReadWrite = pointer.Int64(diskMBpsReadWrite)
-		}
-
-		if options.LogicalSectorSize != 0 {
-			klog.V(2).Infof("AzureDisk - requested LogicalSectorSize: %v", options.LogicalSectorSize)
-			diskProperties.CreationData.LogicalSectorSize = pointer.Int32(options.LogicalSectorSize)
-		}
-	} else {
-		if options.DiskIOPSReadWrite != "" {
-			return "", fmt.Errorf("AzureDisk - DiskIOPSReadWrite parameter is only applicable in UltraSSD_LRS disk type")
-		}
-		if options.DiskMBpsReadWrite != "" {
-			return "", fmt.Errorf("AzureDisk - DiskMBpsReadWrite parameter is only applicable in UltraSSD_LRS disk type")
-		}
-		if options.LogicalSectorSize != 0 {
-			return "", fmt.Errorf("AzureDisk - LogicalSectorSize parameter is only applicable in UltraSSD_LRS disk type")
-		}
-	}
-
-	if options.DiskEncryptionSetID != "" {
-		if strings.Index(strings.ToLower(options.DiskEncryptionSetID), "/subscriptions/") != 0 {
-			return "", fmt.Errorf("AzureDisk - format of DiskEncryptionSetID(%s) is incorrect, correct format: %s", options.DiskEncryptionSetID, consts.DiskEncryptionSetIDFormat)
-		}
-		encryptionType := compute.EncryptionTypeEncryptionAtRestWithCustomerKey
-		if options.DiskEncryptionType != "" {
-			encryptionType = compute.EncryptionType(options.DiskEncryptionType)
-			klog.V(4).Infof("azureDisk - DiskEncryptionType: %s, DiskEncryptionSetID: %s", options.DiskEncryptionType, options.DiskEncryptionSetID)
-		}
-		diskProperties.Encryption = &compute.Encryption{
-			DiskEncryptionSetID: &options.DiskEncryptionSetID,
-			Type:                encryptionType,
-		}
-	} else {
-		if options.DiskEncryptionType != "" {
-			return "", fmt.Errorf("AzureDisk - DiskEncryptionType(%s) should be empty when DiskEncryptionSetID is not set", options.DiskEncryptionType)
-		}
-	}
-
-	if options.MaxShares > 1 {
-		diskProperties.MaxShares = &options.MaxShares
-	}
-
-	location := c.cloud.Location
-	if options.Location != "" {
-		location = options.Location
-	}
-	model := compute.Disk{
-		Location: &location,
-		Tags:     newTags,
-		Sku: &compute.DiskSku{
-			Name: diskSku,
-		},
-		DiskProperties: &diskProperties,
-	}
-
-	if c.cloud.HasExtendedLocation() {
-		model.ExtendedLocation = &compute.ExtendedLocation{
-			Name: pointer.String(c.cloud.ExtendedLocationName),
-			Type: compute.ExtendedLocationTypes(c.cloud.ExtendedLocationType),
-		}
-	}
-
-	if len(createZones) > 0 {
-		model.Zones = &createZones
-	}
-
-	if rerr := c.cloud.DisksClient.CreateOrUpdate(ctx, subsID, rg, options.DiskName, model); rerr != nil {
-		return "", rerr.Error()
-	}
-
-	diskID := fmt.Sprintf(managedDiskPath, subsID, rg, options.DiskName)
-
-	if options.SkipGetDiskOperation {
-		klog.Warningf("azureDisk - GetDisk(%s, StorageAccountType:%s) is throttled, unable to confirm provisioningState in poll process", options.DiskName, options.StorageAccountType)
-	} else {
-		err = kwait.ExponentialBackoffWithContext(ctx, defaultBackOff, func(ctx context.Context) (bool, error) {
-			provisionState, id, err := c.GetDisk(ctx, subsID, rg, options.DiskName)
-			if err == nil {
-				if id != "" {
-					diskID = id
-				}
-			} else {
-				// We are waiting for provisioningState==Succeeded
-				// We don't want to hand-off managed disks to k8s while they are
-				//still being provisioned, this is to avoid some race conditions
-				return false, err
-			}
-			if strings.ToLower(provisionState) == "succeeded" {
-				return true, nil
-			}
-			return false, nil
-		})
-
-		if err != nil {
-			klog.Warningf("azureDisk - created new MD Name:%s StorageAccountType:%s Size:%v but was unable to confirm provisioningState in poll process", options.DiskName, options.StorageAccountType, options.SizeGB)
-		}
-	}
-
-	klog.V(2).Infof("azureDisk - created new MD Name:%s StorageAccountType:%s Size:%v", options.DiskName, options.StorageAccountType, options.SizeGB)
-	return diskID, nil
-}
-
-// DeleteManagedDisk : delete managed disk
-func (c *ManagedDiskController) DeleteManagedDisk(ctx context.Context, diskURI string) error {
-	resourceGroup, subsID, err := getInfoFromDiskURI(diskURI)
-	if err != nil {
-		return err
-	}
-
-	if state, ok := c.diskStateMap.Load(strings.ToLower(diskURI)); ok {
-		return fmt.Errorf("failed to delete disk(%s) since it's in %s state", diskURI, state.(string))
-	}
-
-	diskName := path.Base(diskURI)
-	disk, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName)
-	if rerr != nil {
-		if rerr.HTTPStatusCode == http.StatusNotFound {
-			klog.V(2).Infof("azureDisk - disk(%s) is already deleted", diskURI)
-			return nil
-		}
-		// ignore GetDisk throttling
-		if !rerr.IsThrottled() && !strings.Contains(rerr.RawError.Error(), consts.RateLimited) {
-			return rerr.Error()
-		}
-	}
-	if disk.ManagedBy != nil {
-		return fmt.Errorf("disk(%s) already attached to node(%s), could not be deleted", diskURI, *disk.ManagedBy)
-	}
-
-	if rerr := c.cloud.DisksClient.Delete(ctx, subsID, resourceGroup, diskName); rerr != nil {
-		return rerr.Error()
-	}
-	// We don't need poll here, k8s will immediately stop referencing the disk
-	// the disk will be eventually deleted - cleanly - by ARM
-
-	klog.V(2).Infof("azureDisk - deleted a managed disk: %s", diskURI)
-
-	return nil
-}
-
-// GetDisk return: disk provisionState, diskID, error
-func (c *ManagedDiskController) GetDisk(ctx context.Context, subsID, resourceGroup, diskName string) (string, string, error) {
-	result, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName)
-	if rerr != nil {
-		return "", "", rerr.Error()
-	}
-
-	if result.DiskProperties != nil && (*result.DiskProperties).ProvisioningState != nil {
-		return *(*result.DiskProperties).ProvisioningState, *result.ID, nil
-	}
-	return "", "", nil
-}
-
-// ResizeDisk Expand the disk to new size
-func (c *ManagedDiskController) ResizeDisk(ctx context.Context, diskURI string, oldSize resource.Quantity, newSize resource.Quantity, supportOnlineResize bool) (resource.Quantity, error) {
-	diskName := path.Base(diskURI)
-	resourceGroup, subsID, err := getInfoFromDiskURI(diskURI)
-	if err != nil {
-		return oldSize, err
-	}
-
-	result, rerr := c.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName)
-	if rerr != nil {
-		return oldSize, rerr.Error()
-	}
-
-	if result.DiskProperties == nil || result.DiskProperties.DiskSizeGB == nil {
-		return oldSize, fmt.Errorf("DiskProperties of disk(%s) is nil", diskName)
-	}
-
-	// Azure resizes in chunks of GiB (not GB)
-	requestGiB, err := volumehelpers.RoundUpToGiBInt32(newSize)
-	if err != nil {
-		return oldSize, err
-	}
-
-	newSizeQuant := resource.MustParse(fmt.Sprintf("%dGi", requestGiB))
-
-	klog.V(2).Infof("azureDisk - begin to resize disk(%s) with new size(%d), old size(%v)", diskName, requestGiB, oldSize)
-	// If disk already of greater or equal size than requested we return
-	if *result.DiskProperties.DiskSizeGB >= requestGiB {
-		return newSizeQuant, nil
-	}
-
-	if !supportOnlineResize && result.DiskProperties.DiskState != compute.Unattached {
-		return oldSize, fmt.Errorf("azureDisk - disk resize is only supported on Unattached disk, current disk state: %s, already attached to %s", result.DiskProperties.DiskState, pointer.StringDeref(result.ManagedBy, ""))
-	}
-
-	diskParameter := compute.DiskUpdate{
-		DiskUpdateProperties: &compute.DiskUpdateProperties{
-			DiskSizeGB: &requestGiB,
-		},
-	}
-
-	if rerr := c.cloud.DisksClient.Update(ctx, subsID, resourceGroup, diskName, diskParameter); rerr != nil {
-		return oldSize, rerr.Error()
-	}
-
-	klog.V(2).Infof("azureDisk - resize disk(%s) with new size(%d) completed", diskName, requestGiB)
-	return newSizeQuant, nil
-}
-
-// get resource group name, subs id from a managed disk URI, e.g. return {group-name}, {sub-id} according to
-// /subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}
-// according to https://docs.microsoft.com/en-us/rest/api/compute/disks/get
-func getInfoFromDiskURI(diskURI string) (string, string, error) {
-	fields := strings.Split(diskURI, "/")
-	if len(fields) != 9 || strings.ToLower(fields[3]) != "resourcegroups" {
-		return "", "", fmt.Errorf("invalid disk URI: %s", diskURI)
-	}
-	return fields[4], fields[2], nil
-}
-
-// PVLabeler is an abstract, pluggable interface for fetching labels for volumes
-// GetLabelsForVolume implements PVLabeler.GetLabelsForVolume
-func (c *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) {
-	// Ignore if not AzureDisk.
-	if pv.Spec.AzureDisk == nil {
-		return nil, nil
-	}
-
-	// Ignore any volumes that are being provisioned
-	if pv.Spec.AzureDisk.DiskName == cloudvolume.ProvisionedVolumeName {
-		return nil, nil
-	}
-
-	return c.GetAzureDiskLabels(ctx, pv.Spec.AzureDisk.DataDiskURI)
-}
-
-// GetAzureDiskLabels gets availability zone labels for Azuredisk.
-func (c *Cloud) GetAzureDiskLabels(ctx context.Context, diskURI string) (map[string]string, error) {
-	// Get disk's resource group.
-	diskName := path.Base(diskURI)
-	resourceGroup, subsID, err := getInfoFromDiskURI(diskURI)
-	if err != nil {
-		klog.Errorf("Failed to get resource group for AzureDisk %s: %v", diskName, err)
-		return nil, err
-	}
-
-	labels := map[string]string{
-		consts.LabelFailureDomainBetaRegion: c.Location,
-	}
-	// no azure credential is set, return nil
-	if c.DisksClient == nil {
-		return labels, nil
-	}
-	disk, rerr := c.DisksClient.Get(ctx, subsID, resourceGroup, diskName)
-	if rerr != nil {
-		klog.Errorf("Failed to get information for AzureDisk %s: %v", diskName, rerr)
-		return nil, rerr.Error()
-	}
-
-	// Check whether availability zone is specified.
-	if disk.Zones == nil || len(*disk.Zones) == 0 {
-		klog.V(4).Infof("Azure disk %s is not zoned", diskName)
-		return labels, nil
-	}
-
-	zones := *disk.Zones
-	zoneID, err := strconv.Atoi(zones[0])
-	if err != nil {
-		return nil, fmt.Errorf("failed to parse zone %v for AzureDisk %v: %w", zones, diskName, err)
-	}
-
-	zone := c.makeZone(c.Location, zoneID)
-	klog.V(4).Infof("Got zone %s for Azure disk %s", zone, diskName)
-	labels[consts.LabelFailureDomainBetaZone] = zone
-	return labels, nil
-}
diff --git a/pkg/provider/azure_storageaccount.go b/pkg/provider/azure_storageaccount.go
index a8d683efc..fc071fd82 100644
--- a/pkg/provider/azure_storageaccount.go
+++ b/pkg/provider/azure_storageaccount.go
@@ -285,7 +285,7 @@ func (az *Cloud) EnsureStorageAccount(ctx context.Context, accountOptions *Accou
 		}
 
 		if len(accountOptions.StorageEndpointSuffix) == 0 {
-			accountOptions.StorageEndpointSuffix = az.cloud.Environment.StorageEndpointSuffix
+			accountOptions.StorageEndpointSuffix = az.Environment.StorageEndpointSuffix
 		}
 		privateDNSZoneName = fmt.Sprintf(privateDNSZoneNameFmt, accountOptions.StorageType, accountOptions.StorageEndpointSuffix)
 	}
@@ -635,10 +635,10 @@ func (az *Cloud) createPrivateDNSZone(ctx context.Context, vnetResourceGroup, pr
 func (az *Cloud) createVNetLink(ctx context.Context, vNetLinkName, vnetResourceGroup, vnetName, privateDNSZoneName string) error {
 	klog.V(2).Infof("Creating virtual link for vnet(%s) and DNS Zone(%s) in resourceGroup(%s)", vNetLinkName, privateDNSZoneName, vnetResourceGroup)
 	var clientFactory azclient.ClientFactory
-	if az.cloud.NetworkClientFactory != nil {
-		clientFactory = az.cloud.NetworkClientFactory
+	if az.NetworkClientFactory != nil {
+		clientFactory = az.NetworkClientFactory
 	} else {
-		clientFactory = az.cloud.ComputeClientFactory
+		clientFactory = az.ComputeClientFactory
 	}
 	vnetLinkClient := clientFactory.GetVirtualNetworkLinkClient()
 
diff --git a/pkg/provider/azure_utils.go b/pkg/provider/azure_utils.go
index 70ae36338..912f2d88c 100644
--- a/pkg/provider/azure_utils.go
+++ b/pkg/provider/azure_utils.go
@@ -44,21 +44,21 @@ var strToExtendedLocationType = map[string]network.ExtendedLocationTypes{
 	"edgezone": network.EdgeZone,
 }
 
-// lockMap used to lock on entries
-type lockMap struct {
+// LockMap used to lock on entries
+type LockMap struct {
 	sync.Mutex
 	mutexMap map[string]*sync.Mutex
 }
 
 // NewLockMap returns a new lock map
-func newLockMap() *lockMap {
-	return &lockMap{
+func newLockMap() *LockMap {
+	return &LockMap{
 		mutexMap: make(map[string]*sync.Mutex),
 	}
 }
 
 // LockEntry acquires a lock associated with the specific entry
-func (lm *lockMap) LockEntry(entry string) {
+func (lm *LockMap) LockEntry(entry string) {
 	lm.Lock()
 	// check if entry does not exists, then add entry
 	mutex, exists := lm.mutexMap[entry]
@@ -71,7 +71,7 @@ func (lm *lockMap) LockEntry(entry string) {
 }
 
 // UnlockEntry release the lock associated with the specific entry
-func (lm *lockMap) UnlockEntry(entry string) {
+func (lm *LockMap) UnlockEntry(entry string) {
 	lm.Lock()
 	defer lm.Unlock()
 
diff --git a/pkg/provider/azure_vmsets.go b/pkg/provider/azure_vmsets.go
index e405ef3a7..c40a96f30 100644
--- a/pkg/provider/azure_vmsets.go
+++ b/pkg/provider/azure_vmsets.go
@@ -112,3 +112,12 @@ type VMSet interface {
 	// DeleteCacheForNode removes the node entry from cache.
 	DeleteCacheForNode(nodeName string) error
 }
+
+// AttachDiskOptions attach disk options
+type AttachDiskOptions struct {
+	CachingMode             compute.CachingTypes
+	DiskName                string
+	DiskEncryptionSetID     string
+	WriteAcceleratorEnabled bool
+	Lun                     int32
+}
diff --git a/pkg/provider/azure_vmss.go b/pkg/provider/azure_vmss.go
index d423a2dfd..69389b263 100644
--- a/pkg/provider/azure_vmss.go
+++ b/pkg/provider/azure_vmss.go
@@ -101,7 +101,7 @@ type ScaleSet struct {
 	nonVmssUniformNodesCache azcache.Resource
 
 	// lockMap in cache refresh
-	lockMap *lockMap
+	lockMap *LockMap
 }
 
 // newScaleSet creates a new ScaleSet.
@@ -144,6 +144,7 @@ func newScaleSet(ctx context.Context, az *Cloud) (VMSet, error) {
 		return nil, err
 	}
 
+	ss.lockMap = newLockMap()
 	return ss, nil
 }
 
diff --git a/pkg/provider/azure_vmss_cache.go b/pkg/provider/azure_vmss_cache.go
index 592e05d16..8cc176333 100644
--- a/pkg/provider/azure_vmss_cache.go
+++ b/pkg/provider/azure_vmss_cache.go
@@ -288,9 +288,6 @@ func (ss *ScaleSet) DeleteCacheForNode(nodeName string) error {
 }
 
 func (ss *ScaleSet) updateCache(nodeName, resourceGroupName, vmssName, instanceID string, updatedVM *compute.VirtualMachineScaleSetVM) error {
-	if ss.ManagedDiskController.DisableUpdateCache {
-		return nil
-	}
 	// lock the VMSS entry to ensure a consistent view of the VM map when there are concurrent updates.
 	cacheKey := getVMSSVMCacheKey(resourceGroupName, vmssName)
 	ss.lockMap.LockEntry(cacheKey)
diff --git a/pkg/provider/azure_vmssflex.go b/pkg/provider/azure_vmssflex.go
index c1a4f8893..ef98ae0eb 100644
--- a/pkg/provider/azure_vmssflex.go
+++ b/pkg/provider/azure_vmssflex.go
@@ -48,14 +48,13 @@ var (
 type FlexScaleSet struct {
 	*Cloud
 
-	vmssFlexCache azcache.Resource
-
+	vmssFlexCache            azcache.Resource
 	vmssFlexVMNameToVmssID   *sync.Map
 	vmssFlexVMNameToNodeName *sync.Map
 	vmssFlexVMCache          azcache.Resource
 
 	// lockMap in cache refresh
-	lockMap *lockMap
+	lockMap *LockMap
 }
 
 func newFlexScaleSet(ctx context.Context, az *Cloud) (VMSet, error) {


Test patch:
diff --git a/pkg/provider/azure_controller_common_test.go b/pkg/provider/azure_controller_common_test.go
deleted file mode 100644
index f4064a7f8..000000000
--- a/pkg/provider/azure_controller_common_test.go
+++ /dev/null
@@ -1,1328 +0,0 @@
-/*
-Copyright 2020 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
-	"context"
-	"encoding/json"
-	"errors"
-	"fmt"
-	"net/http"
-	"reflect"
-	"strconv"
-	"strings"
-	"testing"
-	"time"
-
-	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute"
-	"github.com/Azure/go-autorest/autorest/azure"
-	autorestmocks "github.com/Azure/go-autorest/autorest/mocks"
-	"github.com/stretchr/testify/assert"
-	"go.uber.org/mock/gomock"
-
-	"k8s.io/apimachinery/pkg/types"
-	"k8s.io/apimachinery/pkg/util/wait"
-	cloudprovider "k8s.io/cloud-provider"
-	"k8s.io/utils/pointer"
-
-	"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/diskclient/mockdiskclient"
-	"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmclient/mockvmclient"
-	"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssclient/mockvmssclient"
-	"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/vmssvmclient/mockvmssvmclient"
-	"sigs.k8s.io/cloud-provider-azure/pkg/consts"
-	"sigs.k8s.io/cloud-provider-azure/pkg/retry"
-)
-
-var (
-	operationPreemptedError      = retry.NewError(false, errors.New(`Code="OperationPreempted" Message="Operation execution has been preempted by a more recent operation."`))
-	conflictingUserInputError    = retry.NewError(false, errors.New(`Code="ConflictingUserInput" Message="Cannot attach the disk pvc-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx to VM /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachineScaleSets/aks-nodepool0-00000000-vmss/virtualMachines/aks-nodepool0-00000000-vmss_0 because it is already attached to VM /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachineScaleSets/aks-nodepool0-00000000-vmss/virtualMachines/aks-nodepool0-00000000-vmss_1. A disk can be attached to only one VM at a time."`))
-	vmExtensionProvisioningError = retry.NewError(false, errors.New(`Code="VMExtensionProvisioningError" Message="Multiple VM extensions failed to be provisioned on the VM. Please see the VM extension instance view for other failures. The first extension failed due to the error: VM 'aks-nodepool0-00000000-vmss_00' has not reported status for VM agent or extensions. Verify that the OS is up and healthy, the VM has a running VM agent, and that it can establish outbound connections to Azure storage. Please refer to https://aka.ms/vmextensionlinuxtroubleshoot for additional VM agent troubleshooting information."`))
-)
-
-func fakeUpdateAsync(statusCode int) func(context.Context, string, string, compute.VirtualMachineUpdate, string) (*azure.Future, *retry.Error) {
-	return func(ctx context.Context, resourceGroup, nodeName string, parameters compute.VirtualMachineUpdate, source string) (*azure.Future, *retry.Error) {
-		vm := &compute.VirtualMachine{
-			Name:                     &nodeName,
-			Plan:                     parameters.Plan,
-			VirtualMachineProperties: parameters.VirtualMachineProperties,
-			Identity:                 parameters.Identity,
-			Zones:                    parameters.Zones,
-			Tags:                     parameters.Tags,
-		}
-		s, err := json.Marshal(vm)
-		if err != nil {
-			return nil, retry.NewError(false, err)
-		}
-
-		body := autorestmocks.NewBodyWithBytes(s)
-
-		r := autorestmocks.NewResponseWithBodyAndStatus(body, statusCode, strconv.Itoa(statusCode))
-		r.Request.Method = http.MethodPut
-
-		f, err := azure.NewFutureFromResponse(r)
-		if err != nil {
-			return nil, retry.NewError(false, err)
-		}
-
-		return &f, nil
-	}
-}
-
-func TestCommonAttachDisk(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	initVM := func(testCloud *Cloud, expectedVMs []compute.VirtualMachine) {
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		for _, vm := range expectedVMs {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-		}
-		if len(expectedVMs) == 0 {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any()).Return(compute.VirtualMachine{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-		}
-	}
-
-	defaultSetup := func(testCloud *Cloud, expectedVMs []compute.VirtualMachine, statusCode int, result *retry.Error) {
-		initVM(testCloud, expectedVMs)
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(fakeUpdateAsync(statusCode)).MaxTimes(1)
-		mockVMsClient.EXPECT().Update(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).MaxTimes(1)
-		mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, result).MaxTimes(1)
-	}
-
-	maxShare := int32(1)
-	goodInstanceID := fmt.Sprintf("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/%s", "vm1")
-	diskEncryptionSetID := fmt.Sprintf("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/diskEncryptionSets/%s", "diskEncryptionSet-name")
-	testTags := make(map[string]*string)
-	testTags[WriteAcceleratorEnabled] = pointer.String("true")
-	testCases := []struct {
-		desc                 string
-		diskName             string
-		existedDisk          *compute.Disk
-		nodeName             types.NodeName
-		vmList               map[string]string
-		isDataDisksFull      bool
-		isBadDiskURI         bool
-		isDiskUsed           bool
-		setup                func(testCloud *Cloud, expectedVMs []compute.VirtualMachine, statusCode int, result *retry.Error)
-		expectErr            bool
-		isAcceptedErr        bool
-		isContextDeadlineErr bool
-		statusCode           int
-		waitResult           *retry.Error
-		expectedLun          int32
-		contextDuration      time.Duration
-	}{
-		{
-			desc:        "correct LUN and no error shall be returned if disk is nil",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk-name",
-			existedDisk: nil,
-			expectedLun: 3,
-			expectErr:   false,
-			statusCode:  200,
-		},
-		{
-			desc:        "LUN -1 and error shall be returned if there's no such instance corresponding to given nodeName",
-			nodeName:    "vm1",
-			diskName:    "disk-name",
-			existedDisk: &compute.Disk{Name: pointer.String("disk-name")},
-			expectedLun: -1,
-			expectErr:   true,
-		},
-		{
-			desc:            "LUN -1 and error shall be returned if there's no available LUN for instance",
-			vmList:          map[string]string{"vm1": "PowerState/Running"},
-			nodeName:        "vm1",
-			isDataDisksFull: true,
-			diskName:        "disk-name",
-			existedDisk:     &compute.Disk{Name: pointer.String("disk-name")},
-			expectedLun:     -1,
-			expectErr:       true,
-		},
-		{
-			desc:     "correct LUN and no error shall be returned if everything is good",
-			vmList:   map[string]string{"vm1": "PowerState/Running"},
-			nodeName: "vm1",
-			diskName: "disk-name",
-			existedDisk: &compute.Disk{Name: pointer.String("disk-name"),
-				DiskProperties: &compute.DiskProperties{
-					Encryption: &compute.Encryption{DiskEncryptionSetID: &diskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey},
-					DiskSizeGB: pointer.Int32(4096),
-					DiskState:  compute.Unattached,
-				},
-				Tags: testTags},
-			expectedLun: 3,
-			expectErr:   false,
-			statusCode:  200,
-		},
-		{
-			desc:     "an error shall be returned if disk state is not Unattached",
-			vmList:   map[string]string{"vm1": "PowerState/Running"},
-			nodeName: "vm1",
-			diskName: "disk-name",
-			existedDisk: &compute.Disk{Name: pointer.String("disk-name"),
-				DiskProperties: &compute.DiskProperties{
-					Encryption: &compute.Encryption{DiskEncryptionSetID: &diskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey},
-					DiskSizeGB: pointer.Int32(4096),
-					DiskState:  compute.Attached,
-				},
-				Tags: testTags},
-			expectedLun: -1,
-			expectErr:   true,
-		},
-		{
-			desc:        "an error shall be returned if attach an already attached disk with good ManagedBy instance id",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk-name",
-			existedDisk: &compute.Disk{Name: pointer.String("disk-name"), ManagedBy: pointer.String(goodInstanceID), DiskProperties: &compute.DiskProperties{MaxShares: &maxShare}},
-			expectedLun: -1,
-			expectErr:   true,
-		},
-		{
-			desc:          "should return a PartialUpdateError type when storage configuration was accepted but wait fails with an error",
-			vmList:        map[string]string{"vm1": "PowerState/Running"},
-			nodeName:      "vm1",
-			diskName:      "disk-name",
-			existedDisk:   nil,
-			expectedLun:   -1,
-			expectErr:     true,
-			statusCode:    200,
-			waitResult:    conflictingUserInputError,
-			isAcceptedErr: true,
-		},
-		{
-			desc:        "should not return a PartialUpdateError type when storage configuration was not accepted",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk-name",
-			existedDisk: nil,
-			expectedLun: -1,
-			expectErr:   true,
-			statusCode:  400,
-			waitResult:  conflictingUserInputError,
-		},
-		{
-			desc:        "should retry on OperationPreempted error and succeed",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk-name",
-			existedDisk: nil,
-			expectedLun: 3,
-			expectErr:   false,
-			statusCode:  200,
-			waitResult:  operationPreemptedError,
-			setup: func(testCloud *Cloud, expectedVMs []compute.VirtualMachine, statusCode int, result *retry.Error) {
-				defaultSetup(testCloud, expectedVMs, statusCode, result)
-				mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-				mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(fakeUpdateAsync(200)).AnyTimes()
-				gomock.InOrder(
-					mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, result),
-					mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, nil),
-				)
-			},
-		},
-		{
-			desc:        "should retry on OperationPreempted error until context deadline and return context.DeadlineExceeded error",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk-name",
-			existedDisk: nil,
-			expectedLun: -1,
-			expectErr:   true,
-			statusCode:  200,
-			waitResult:  operationPreemptedError,
-			setup: func(testCloud *Cloud, expectedVMs []compute.VirtualMachine, statusCode int, result *retry.Error) {
-				defaultSetup(testCloud, expectedVMs, statusCode, result)
-				mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-				mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(fakeUpdateAsync(200)).AnyTimes()
-				mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, result).AnyTimes()
-			},
-			contextDuration:      time.Second,
-			isContextDeadlineErr: true,
-		},
-	}
-
-	for i, test := range testCases {
-		tt := test
-		t.Run(tt.desc, func(t *testing.T) {
-			testCloud := GetTestCloud(ctrl)
-			testCloud.DisableDiskLunCheck = true
-			diskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-				testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName)
-			if tt.isBadDiskURI {
-				diskURI = fmt.Sprintf("/baduri/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-					testCloud.SubscriptionID, testCloud.ResourceGroup, tt.diskName)
-			}
-			expectedVMs := setTestVirtualMachines(testCloud, tt.vmList, tt.isDataDisksFull)
-			if tt.isDiskUsed {
-				vm0 := setTestVirtualMachines(testCloud, map[string]string{"vm0": "PowerState/Running"}, tt.isDataDisksFull)[0]
-				expectedVMs = append(expectedVMs, vm0)
-			}
-			if tt.setup == nil {
-				defaultSetup(testCloud, expectedVMs, tt.statusCode, tt.waitResult)
-			} else {
-				tt.setup(testCloud, expectedVMs, tt.statusCode, tt.waitResult)
-			}
-
-			if tt.contextDuration > 0 {
-				oldCtx := ctx
-				ctx, cancel = context.WithTimeout(oldCtx, tt.contextDuration)
-				defer cancel()
-				defer func() {
-					ctx = oldCtx
-				}()
-			}
-
-			lun, err := testCloud.AttachDisk(ctx, test.diskName, diskURI, tt.nodeName, compute.CachingTypesReadOnly, tt.existedDisk, nil)
-
-			assert.Equal(t, tt.expectedLun, lun, "TestCase[%d]: %s", i, tt.desc)
-			assert.Equal(t, tt.expectErr, err != nil, "TestCase[%d]: %s, return error: %v", i, tt.desc, err)
-
-			if tt.isAcceptedErr {
-				assert.IsType(t, &retry.PartialUpdateError{}, err)
-			} else {
-				var partialUpdateError *retry.PartialUpdateError
-				ok := errors.As(err, &partialUpdateError)
-				assert.False(t, ok, "the returned error should not be AcceptedError type")
-			}
-
-			assert.Equal(t, tt.isContextDeadlineErr, errors.Is(err, context.DeadlineExceeded))
-		})
-	}
-}
-
-func TestWaitForUpdateResult(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := context.WithCancel(context.Background())
-	defer cancel()
-
-	defaultSetup := func(testCloud *Cloud, statusCode int, result *retry.Error) {
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(fakeUpdateAsync(statusCode)).MaxTimes(1)
-		mockVMsClient.EXPECT().Update(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).MaxTimes(1)
-		mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, result).MaxTimes(1)
-	}
-
-	testCases := []struct {
-		desc              string
-		nodeName          string
-		statusCode        int
-		waitResult        *retry.Error
-		expectErr         bool
-		expectedErrorType error
-		setup             func(testCloud *Cloud, statusCode int, result *retry.Error)
-		contextDuration   time.Duration
-	}{
-		{
-			desc:              "should return a PartialUpdateError type when storage configuration was accepted but wait fails with an error",
-			nodeName:          "vm1",
-			expectErr:         true,
-			statusCode:        200,
-			waitResult:        conflictingUserInputError,
-			expectedErrorType: &retry.PartialUpdateError{},
-		},
-		{
-			desc:              "should return a PartialUpdateError type when storage configuration was accepted but wait fails with an error",
-			nodeName:          "vm1",
-			expectErr:         true,
-			statusCode:        200,
-			waitResult:        conflictingUserInputError,
-			expectedErrorType: &retry.PartialUpdateError{},
-		},
-		{
-			desc:              "should not return a PartialUpdateError type when storage configuration was not accepted",
-			nodeName:          "vm1",
-			expectErr:         true,
-			statusCode:        400,
-			waitResult:        conflictingUserInputError,
-			expectedErrorType: conflictingUserInputError.Error(),
-		},
-		{
-			desc:       "should retry on OperationPreempted error and succeed",
-			nodeName:   "vm1",
-			expectErr:  false,
-			statusCode: 200,
-			waitResult: operationPreemptedError,
-			setup: func(testCloud *Cloud, statusCode int, result *retry.Error) {
-				defaultSetup(testCloud, statusCode, result)
-				mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-				mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(fakeUpdateAsync(200))
-				gomock.InOrder(
-					mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, result),
-					mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, nil),
-				)
-			},
-		},
-		{
-			desc:     "should retry on OperationPreempted error until context deadline and return context.DeadlineExceeded error",
-			nodeName: "vm1",
-
-			expectErr:  true,
-			statusCode: 200,
-			waitResult: operationPreemptedError,
-			setup: func(testCloud *Cloud, statusCode int, result *retry.Error) {
-				defaultSetup(testCloud, statusCode, result)
-				mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-				mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(fakeUpdateAsync(200)).AnyTimes()
-				mockVMsClient.EXPECT().WaitForUpdateResult(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, gomock.Any()).Return(nil, result).AnyTimes()
-			},
-			contextDuration:   time.Second,
-			expectedErrorType: context.DeadlineExceeded,
-		},
-	}
-
-	for i, test := range testCases {
-		tt := test
-		t.Run(tt.desc, func(t *testing.T) {
-			testCloud := GetTestCloud(ctrl)
-			if tt.setup == nil {
-				defaultSetup(testCloud, tt.statusCode, tt.waitResult)
-			} else {
-				tt.setup(testCloud, tt.statusCode, tt.waitResult)
-			}
-
-			if tt.contextDuration > 0 {
-				oldCtx := ctx
-				ctx, cancel = context.WithTimeout(oldCtx, tt.contextDuration)
-				defer cancel()
-				defer func() {
-					ctx = oldCtx
-				}()
-			}
-
-			r := autorestmocks.NewResponseWithStatus(strconv.Itoa(tt.statusCode), tt.statusCode)
-			r.Request.Method = http.MethodPut
-			future, _ := azure.NewFutureFromResponse(r)
-
-			err := testCloud.waitForUpdateResult(ctx, testCloud.VMSet, types.NodeName(tt.nodeName), &future, nil)
-
-			assert.Equal(t, tt.expectErr, err != nil, "TestCase[%d]: %s, return error: %v", i, tt.desc, err)
-
-			if tt.expectErr {
-				assert.IsType(t, tt.expectedErrorType, err)
-			}
-		})
-	}
-}
-
-func TestCommonAttachDiskWithVMSS(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCases := []struct {
-		desc            string
-		diskName        string
-		nodeName        types.NodeName
-		expectedLun     int32
-		isVMSS          bool
-		isManagedBy     bool
-		isDataDisksFull bool
-		expectedErr     bool
-		vmList          map[string]string
-		vmssList        []string
-		existedDisk     *compute.Disk
-	}{
-		{
-			desc:        "an error shall be returned if convert vmSet to ScaleSet failed",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			isVMSS:      false,
-			isManagedBy: false,
-			diskName:    "disk-name",
-			existedDisk: &compute.Disk{Name: pointer.String("disk-name")},
-			expectedLun: -1,
-			expectedErr: true,
-		},
-		{
-			desc:        "an error shall be returned if convert vmSet to ScaleSet success but node is not managed by availability set",
-			vmssList:    []string{"vmss-vm-000001"},
-			nodeName:    "vmss1",
-			isVMSS:      true,
-			isManagedBy: false,
-			diskName:    "disk-name",
-			existedDisk: &compute.Disk{Name: pointer.String("disk-name")},
-			expectedLun: -1,
-			expectedErr: true,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		testCloud.VMType = consts.VMTypeVMSS
-		if test.isVMSS {
-			if test.isManagedBy {
-				testCloud.DisableAvailabilitySetNodes = false
-				expectedVMSS := compute.VirtualMachineScaleSet{Name: pointer.String(testVMSSName)}
-				mockVMSSClient := testCloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
-				mockVMSSClient.EXPECT().List(gomock.Any(), testCloud.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
-
-				expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(testCloud, testVMSSName, "", 0, test.vmssList, "", false)
-				mockVMSSVMClient := testCloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
-				mockVMSSVMClient.EXPECT().List(gomock.Any(), testCloud.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
-
-				mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-				mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
-			} else {
-				testCloud.DisableAvailabilitySetNodes = true
-			}
-			ss, err := newScaleSet(context.Background(), testCloud)
-			assert.NoError(t, err)
-			testCloud.VMSet = ss
-		}
-
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		diskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-			testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName)
-		if !test.isVMSS {
-			expectedVMs := setTestVirtualMachines(testCloud, test.vmList, test.isDataDisksFull)
-			mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-			for _, vm := range expectedVMs {
-				mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-			}
-			if len(expectedVMs) == 0 {
-				mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any()).Return(compute.VirtualMachine{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-			}
-			mockVMsClient.EXPECT().Update(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
-		}
-
-		lun, err := common.AttachDisk(ctx, "test", diskURI, test.nodeName, compute.CachingTypesReadOnly, test.existedDisk, nil)
-		assert.Equal(t, test.expectedLun, lun, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
-	}
-}
-
-func TestCommonDetachDisk(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCases := []struct {
-		desc        string
-		vmList      map[string]string
-		nodeName    types.NodeName
-		diskName    string
-		expectedErr bool
-	}{
-		{
-			desc:        "error should not be returned if there's no such instance corresponding to given nodeName",
-			nodeName:    "vm1",
-			expectedErr: false,
-		},
-		{
-			desc:        "no error shall be returned if there's no matching disk according to given diskName",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "diskx",
-			expectedErr: false,
-		},
-		{
-			desc:        "error shall be returned if the disk exists",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk1",
-			expectedErr: true,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		diskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/disk-name",
-			testCloud.SubscriptionID, testCloud.ResourceGroup)
-		expectedVMs := setTestVirtualMachines(testCloud, test.vmList, false)
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		for _, vm := range expectedVMs {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-		}
-		if len(expectedVMs) == 0 {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any()).Return(compute.VirtualMachine{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-		}
-		mockVMsClient.EXPECT().Update(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
-
-		err := common.DetachDisk(ctx, test.diskName, diskURI, test.nodeName)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, err: %v", i, test.desc, err)
-	}
-}
-
-func TestCommonUpdateVM(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCases := []struct {
-		desc             string
-		vmList           map[string]string
-		nodeName         types.NodeName
-		diskName         string
-		isErrorRetriable bool
-		expectedErr      bool
-	}{
-		{
-			desc:        "error should not be returned if there's no such instance corresponding to given nodeName",
-			nodeName:    "vm1",
-			expectedErr: false,
-		},
-		{
-			desc:             "an error should be returned if vmset detach failed with isErrorRetriable error",
-			vmList:           map[string]string{"vm1": "PowerState/Running"},
-			nodeName:         "vm1",
-			isErrorRetriable: true,
-			expectedErr:      true,
-		},
-		{
-			desc:        "no error shall be returned if there's no matching disk according to given diskName",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "diskx",
-			expectedErr: false,
-		},
-		{
-			desc:        "no error shall be returned if the disk exists",
-			vmList:      map[string]string{"vm1": "PowerState/Running"},
-			nodeName:    "vm1",
-			diskName:    "disk1",
-			expectedErr: false,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		expectedVMs := setTestVirtualMachines(testCloud, test.vmList, false)
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		for _, vm := range expectedVMs {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-		}
-		if len(expectedVMs) == 0 {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any()).Return(compute.VirtualMachine{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-		}
-		r := autorestmocks.NewResponseWithStatus("200", 200)
-		r.Request.Method = http.MethodPut
-
-		future, err := azure.NewFutureFromResponse(r)
-
-		mockVMsClient.EXPECT().UpdateAsync(gomock.Any(), testCloud.ResourceGroup, gomock.Any(), gomock.Any(), gomock.Any()).Return(&future, err).AnyTimes()
-
-		if test.isErrorRetriable {
-			testCloud.CloudProviderBackoff = true
-			testCloud.ResourceRequestBackoff = wait.Backoff{Steps: 1}
-			mockVMsClient.EXPECT().WaitForUpdateResult(ctx, &future, testCloud.ResourceGroup, gomock.Any()).Return(nil, &retry.Error{HTTPStatusCode: http.StatusBadRequest, Retriable: true, RawError: fmt.Errorf("Retriable: true")}).AnyTimes()
-		} else {
-			mockVMsClient.EXPECT().WaitForUpdateResult(ctx, &future, testCloud.ResourceGroup, gomock.Any()).Return(nil, nil).AnyTimes()
-		}
-
-		err = common.UpdateVM(ctx, test.nodeName)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, err: %v", i, test.desc, err)
-	}
-}
-
-func TestGetDiskLun(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc        string
-		diskName    string
-		diskURI     string
-		expectedLun int32
-		expectedErr bool
-	}{
-		{
-			desc:        "LUN -1 and error shall be returned if diskName != disk.Name or diskURI != disk.Vhd.URI",
-			diskName:    "diskx",
-			expectedLun: -1,
-			expectedErr: true,
-		},
-		{
-			desc:        "correct LUN and no error shall be returned if diskName = disk.Name",
-			diskName:    "disk1",
-			expectedLun: 0,
-			expectedErr: false,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		expectedVMs := setTestVirtualMachines(testCloud, map[string]string{"vm1": "PowerState/Running"}, false)
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		for _, vm := range expectedVMs {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-		}
-
-		lun, _, err := common.GetDiskLun(test.diskName, test.diskURI, "vm1")
-		assert.Equal(t, test.expectedLun, lun, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-	}
-}
-
-func TestSetDiskLun(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc            string
-		nodeName        string
-		diskURI         string
-		diskMap         map[string]*AttachDiskOptions
-		occupiedLuns    []int
-		isDataDisksFull bool
-		expectedErr     bool
-		expectedLun     int32
-	}{
-		{
-			desc:         "the minimal LUN shall be returned if there's enough room for extra disks",
-			nodeName:     "nodeName",
-			diskURI:      "diskURI",
-			occupiedLuns: []int{0, 1, 2},
-			diskMap:      map[string]*AttachDiskOptions{"diskURI": {}},
-			expectedLun:  3,
-			expectedErr:  false,
-		},
-		{
-			desc:         "occupied LUNs shall be skipped",
-			nodeName:     "nodeName",
-			diskURI:      "diskURI",
-			occupiedLuns: []int{0, 1, 2, 3},
-			diskMap:      map[string]*AttachDiskOptions{"diskURI": {}},
-			expectedLun:  4,
-			expectedErr:  false,
-		},
-		{
-			desc:            "LUN -1 and error shall be returned if there's no available LUN",
-			nodeName:        "nodeName",
-			diskURI:         "diskURI",
-			diskMap:         map[string]*AttachDiskOptions{"diskURI": {}},
-			isDataDisksFull: true,
-			expectedLun:     -1,
-			expectedErr:     true,
-		},
-		{
-			desc:        "diskURI1 is not in VM data disk list nor in diskMap",
-			nodeName:    "nodeName",
-			diskURI:     "diskURI1",
-			diskMap:     map[string]*AttachDiskOptions{"diskURI2": {}},
-			expectedLun: -1,
-			expectedErr: true,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		expectedVMs := setTestVirtualMachines(testCloud, map[string]string{test.nodeName: "PowerState/Running"}, test.isDataDisksFull)
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		for _, vm := range expectedVMs {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-		}
-
-		lun, err := common.SetDiskLun(types.NodeName(test.nodeName), test.diskURI, test.diskMap, test.occupiedLuns)
-		assert.Equal(t, test.expectedLun, lun, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-	}
-}
-
-func TestDisksAreAttached(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc             string
-		diskNames        []string
-		nodeName         types.NodeName
-		expectedAttached map[string]bool
-		expectedErr      bool
-	}{
-		{
-			desc:             "an error shall be returned if there's no such instance corresponding to given nodeName",
-			diskNames:        []string{"disk1"},
-			nodeName:         "vm2",
-			expectedAttached: map[string]bool{"disk1": false},
-			expectedErr:      false,
-		},
-		{
-			desc:             "proper attach map shall be returned if everything is good",
-			diskNames:        []string{"disk1", "diskx"},
-			nodeName:         "vm1",
-			expectedAttached: map[string]bool{"disk1": true, "diskx": false},
-			expectedErr:      false,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		expectedVMs := setTestVirtualMachines(testCloud, map[string]string{"vm1": "PowerState/Running"}, false)
-		mockVMsClient := testCloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
-		for _, vm := range expectedVMs {
-			mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, *vm.Name, gomock.Any()).Return(vm, nil).AnyTimes()
-		}
-		mockVMsClient.EXPECT().Get(gomock.Any(), testCloud.ResourceGroup, "vm2", gomock.Any()).Return(compute.VirtualMachine{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-
-		attached, err := common.DisksAreAttached(test.diskNames, test.nodeName)
-		assert.Equal(t, test.expectedAttached, attached, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-	}
-}
-
-func TestGetValidCreationData(t *testing.T) {
-	sourceResourceSnapshotID := "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/snapshots/xxx"
-	sourceResourceVolumeID := "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/disks/xxx"
-
-	tests := []struct {
-		subscriptionID   string
-		resourceGroup    string
-		sourceResourceID string
-		sourceType       string
-		expected1        compute.CreationData
-		expected2        error
-	}{
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "",
-			sourceType:       "",
-			expected1: compute.CreationData{
-				CreateOption: compute.Empty,
-			},
-			expected2: nil,
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/snapshots/xxx",
-			sourceType:       sourceSnapshot,
-			expected1: compute.CreationData{
-				CreateOption:     compute.Copy,
-				SourceResourceID: &sourceResourceSnapshotID,
-			},
-			expected2: nil,
-		},
-		{
-			subscriptionID:   "xxx",
-			resourceGroup:    "xxx",
-			sourceResourceID: "xxx",
-			sourceType:       sourceSnapshot,
-			expected1: compute.CreationData{
-				CreateOption:     compute.Copy,
-				SourceResourceID: &sourceResourceSnapshotID,
-			},
-			expected2: nil,
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "/subscriptions/23/providers/Microsoft.Compute/disks/name",
-			sourceType:       sourceSnapshot,
-			expected1:        compute.CreationData{},
-			expected2:        fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", "/subscriptions//resourceGroups//providers/Microsoft.Compute/snapshots//subscriptions/23/providers/Microsoft.Compute/disks/name", diskSnapshotPathRE),
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "http://test.com/vhds/name",
-			sourceType:       sourceSnapshot,
-			expected1:        compute.CreationData{},
-			expected2:        fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", "/subscriptions//resourceGroups//providers/Microsoft.Compute/snapshots/http://test.com/vhds/name", diskSnapshotPathRE),
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "/subscriptions/xxx/snapshots/xxx",
-			sourceType:       sourceSnapshot,
-			expected1:        compute.CreationData{},
-			expected2:        fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", "/subscriptions//resourceGroups//providers/Microsoft.Compute/snapshots//subscriptions/xxx/snapshots/xxx", diskSnapshotPathRE),
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/snapshots/xxx/snapshots/xxx/snapshots/xxx",
-			sourceType:       sourceSnapshot,
-			expected1:        compute.CreationData{},
-			expected2:        fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/snapshots/xxx/snapshots/xxx/snapshots/xxx", diskSnapshotPathRE),
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "xxx",
-			sourceType:       "",
-			expected1: compute.CreationData{
-				CreateOption: compute.Empty,
-			},
-			expected2: nil,
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/disks/xxx",
-			sourceType:       sourceVolume,
-			expected1: compute.CreationData{
-				CreateOption:     compute.Copy,
-				SourceResourceID: &sourceResourceVolumeID,
-			},
-			expected2: nil,
-		},
-		{
-			subscriptionID:   "xxx",
-			resourceGroup:    "xxx",
-			sourceResourceID: "xxx",
-			sourceType:       sourceVolume,
-			expected1: compute.CreationData{
-				CreateOption:     compute.Copy,
-				SourceResourceID: &sourceResourceVolumeID,
-			},
-			expected2: nil,
-		},
-		{
-			subscriptionID:   "",
-			resourceGroup:    "",
-			sourceResourceID: "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/snapshots/xxx",
-			sourceType:       sourceVolume,
-			expected1:        compute.CreationData{},
-			expected2:        fmt.Errorf("sourceResourceID(%s) is invalid, correct format: %s", "/subscriptions//resourceGroups//providers/Microsoft.Compute/disks//subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/snapshots/xxx", managedDiskPathRE),
-		},
-	}
-
-	for _, test := range tests {
-		options := ManagedDiskOptions{
-			SourceResourceID: test.sourceResourceID,
-			SourceType:       test.sourceType,
-		}
-		result, err := getValidCreationData(test.subscriptionID, test.resourceGroup, &options)
-		if !reflect.DeepEqual(result, test.expected1) || !reflect.DeepEqual(err, test.expected2) {
-			t.Errorf("input sourceResourceID: %v, sourceType: %v, getValidCreationData result: %v, expected1 : %v, err: %v, expected2: %v", test.sourceResourceID, test.sourceType, result, test.expected1, err, test.expected2)
-		}
-	}
-}
-
-func TestCheckDiskExists(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCloud := GetTestCloud(ctrl)
-	common := &controllerCommon{
-		cloud:   testCloud,
-		lockMap: newLockMap(),
-	}
-	// create a new disk before running test
-	newDiskName := "newdisk"
-	newDiskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-		testCloud.SubscriptionID, testCloud.ResourceGroup, newDiskName)
-
-	mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-	mockDisksClient.EXPECT().Get(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, newDiskName).Return(compute.Disk{}, nil).AnyTimes()
-	mockDisksClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Not(testCloud.ResourceGroup), gomock.Any()).Return(compute.Disk{}, &retry.Error{HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-
-	testCases := []struct {
-		diskURI        string
-		expectedResult bool
-		expectedErr    bool
-	}{
-		{
-			diskURI:        "incorrect disk URI format",
-			expectedResult: false,
-			expectedErr:    true,
-		},
-		{
-			diskURI:        "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/disks/non-existing-disk",
-			expectedResult: false,
-			expectedErr:    false,
-		},
-		{
-			diskURI:        newDiskURI,
-			expectedResult: true,
-			expectedErr:    false,
-		},
-	}
-
-	for i, test := range testCases {
-		exist, err := common.checkDiskExists(ctx, test.diskURI)
-		assert.Equal(t, test.expectedResult, exist, "TestCase[%d]", i, exist)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d], return error: %v", i, err)
-	}
-}
-
-func TestFilterNonExistingDisksWithSpecialHTTPStatusCode(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCloud := GetTestCloud(ctrl)
-	common := &controllerCommon{
-		cloud:   testCloud,
-		lockMap: newLockMap(),
-	}
-	// create a new disk before running test
-	diskURIPrefix := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/",
-		testCloud.SubscriptionID, testCloud.ResourceGroup)
-	newDiskName := "specialdisk"
-	newDiskURI := diskURIPrefix + newDiskName
-
-	mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-	mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, gomock.Eq(newDiskName)).Return(compute.Disk{}, &retry.Error{HTTPStatusCode: http.StatusBadRequest, RawError: cloudprovider.InstanceNotFound}).AnyTimes()
-
-	disks := []compute.DataDisk{
-		{
-			Name: &newDiskName,
-			ManagedDisk: &compute.ManagedDiskParameters{
-				ID: &newDiskURI,
-			},
-		},
-	}
-
-	filteredDisks := common.filterNonExistingDisks(ctx, disks)
-	assert.Equal(t, 1, len(filteredDisks))
-	assert.Equal(t, newDiskName, *filteredDisks[0].Name)
-}
-
-func TestIsInstanceNotFoundError(t *testing.T) {
-	testCases := []struct {
-		errMsg         string
-		expectedResult bool
-	}{
-		{
-			errMsg:         "",
-			expectedResult: false,
-		},
-		{
-			errMsg:         "other error",
-			expectedResult: false,
-		},
-		{
-			errMsg:         "The provided instanceId 857 is not an active Virtual Machine Scale Set VM instanceId.",
-			expectedResult: true,
-		},
-		{
-			errMsg:         `compute.VirtualMachineScaleSetVMsClient#Update: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="The provided instanceId 1181 is not an active Virtual Machine Scale Set VM instanceId." Target="instanceIds"`,
-			expectedResult: true,
-		},
-	}
-
-	for i, test := range testCases {
-		result := isInstanceNotFoundError(fmt.Errorf(test.errMsg))
-		assert.Equal(t, test.expectedResult, result, "TestCase[%d]", i, result)
-	}
-}
-
-func TestAttachDiskRequestFuncs(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc                 string
-		diskURI              string
-		nodeName             string
-		diskName             string
-		diskNum              int
-		duplicateDiskRequest bool
-		expectedErr          bool
-	}{
-		{
-			desc:        "one disk request in queue",
-			diskURI:     "diskURI",
-			nodeName:    "nodeName",
-			diskName:    "diskName",
-			diskNum:     1,
-			expectedErr: false,
-		},
-		{
-			desc:        "multiple disk requests in queue",
-			diskURI:     "diskURI",
-			nodeName:    "nodeName",
-			diskName:    "diskName",
-			diskNum:     10,
-			expectedErr: false,
-		},
-		{
-			desc:        "zero disk request in queue",
-			diskURI:     "diskURI",
-			nodeName:    "nodeName",
-			diskName:    "diskName",
-			diskNum:     0,
-			expectedErr: false,
-		},
-		{
-			desc:                 "multiple disk requests in queue",
-			diskURI:              "diskURI",
-			nodeName:             "nodeName",
-			diskName:             "diskName",
-			duplicateDiskRequest: true,
-			diskNum:              10,
-			expectedErr:          false,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		for i := 1; i <= test.diskNum; i++ {
-			diskURI := fmt.Sprintf("%s%d", test.diskURI, i)
-			diskName := fmt.Sprintf("%s%d", test.diskName, i)
-			attachDiskOptions := &AttachDiskOptions{DiskName: diskName}
-			_, err := common.insertAttachDiskRequest(diskURI, test.nodeName, attachDiskOptions)
-			assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-			if test.duplicateDiskRequest {
-				_, err := common.insertAttachDiskRequest(diskURI, test.nodeName, attachDiskOptions)
-				assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-			}
-		}
-
-		diskMap, err := common.cleanAttachDiskRequests(test.nodeName)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.diskNum, len(diskMap), "TestCase[%d]: %s", i, test.desc)
-		for diskURI, opt := range diskMap {
-			assert.Equal(t, strings.Contains(diskURI, test.diskURI), true, "TestCase[%d]: %s", i, test.desc)
-			assert.Equal(t, strings.Contains(opt.DiskName, test.diskName), true, "TestCase[%d]: %s", i, test.desc)
-		}
-	}
-}
-
-func TestDetachDiskRequestFuncs(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc                 string
-		diskURI              string
-		nodeName             string
-		diskName             string
-		diskNum              int
-		duplicateDiskRequest bool
-		expectedErr          bool
-	}{
-		{
-			desc:        "one disk request in queue",
-			diskURI:     "diskURI",
-			nodeName:    "nodeName",
-			diskName:    "diskName",
-			diskNum:     1,
-			expectedErr: false,
-		},
-		{
-			desc:        "multiple disk requests in queue",
-			diskURI:     "diskURI",
-			nodeName:    "nodeName",
-			diskName:    "diskName",
-			diskNum:     10,
-			expectedErr: false,
-		},
-		{
-			desc:        "zero disk request in queue",
-			diskURI:     "diskURI",
-			nodeName:    "nodeName",
-			diskName:    "diskName",
-			diskNum:     0,
-			expectedErr: false,
-		},
-		{
-			desc:                 "multiple disk requests in queue",
-			diskURI:              "diskURI",
-			nodeName:             "nodeName",
-			diskName:             "diskName",
-			duplicateDiskRequest: true,
-			diskNum:              10,
-			expectedErr:          false,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		common := &controllerCommon{
-			cloud:   testCloud,
-			lockMap: newLockMap(),
-		}
-		for i := 1; i <= test.diskNum; i++ {
-			diskURI := fmt.Sprintf("%s%d", test.diskURI, i)
-			diskName := fmt.Sprintf("%s%d", test.diskName, i)
-			_, err := common.insertDetachDiskRequest(diskName, diskURI, test.nodeName)
-			assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-			if test.duplicateDiskRequest {
-				_, err := common.insertDetachDiskRequest(diskName, diskURI, test.nodeName)
-				assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-			}
-		}
-
-		diskMap, err := common.cleanDetachDiskRequests(test.nodeName)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.diskNum, len(diskMap), "TestCase[%d]: %s", i, test.desc)
-		for diskURI, diskName := range diskMap {
-			assert.Equal(t, strings.Contains(diskURI, test.diskURI), true, "TestCase[%d]: %s", i, test.desc)
-			assert.Equal(t, strings.Contains(diskName, test.diskName), true, "TestCase[%d]: %s", i, test.desc)
-		}
-	}
-}
-
-func TestGetAzureErrorCode(t *testing.T) {
-	testCases := []struct {
-		desc           string
-		err            error
-		expectedResult string
-	}{
-		{
-			desc:           "should return OperationPreempted",
-			err:            operationPreemptedError.Error(),
-			expectedResult: consts.OperationPreemptedErrorCode,
-		},
-		{
-			desc:           "should return VMExtensionprovisioning",
-			err:            vmExtensionProvisioningError.Error(),
-			expectedResult: "VMExtensionProvisioningError",
-		},
-		{
-			desc:           "should return ConflictingUserInput",
-			err:            conflictingUserInputError.Error(),
-			expectedResult: "ConflictingUserInput",
-		},
-	}
-	for i, test := range testCases {
-		tt := test
-		t.Run(tt.desc, func(t *testing.T) {
-			result := getAzureErrorCode(test.err)
-			assert.Equal(t, test.expectedResult, result, "TestCase[%d]", i, result)
-		})
-	}
-}
-
-func TestVmUpdateRequired(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	r := autorestmocks.NewResponseWithStatus("200", 200)
-	r.Request.Method = http.MethodPut
-
-	acceptedFuture, _ := azure.NewFutureFromResponse(r)
-
-	r = autorestmocks.NewResponseWithStatus("400", 400)
-	r.Request.Method = http.MethodPut
-
-	rejectedFuture, _ := azure.NewFutureFromResponse(r)
-
-	testCases := []struct {
-		desc           string
-		configAccepted bool
-		err            error
-		expectedResult bool
-	}{
-		{
-			desc:           "should return true if OperationPreemption error is returned with a http status code 2xx",
-			configAccepted: true,
-			err:            operationPreemptedError.Error(),
-			expectedResult: true,
-		},
-		{
-			desc:           "should return false if OperationPreemption error is returned with a http status code != 2xx",
-			configAccepted: false,
-			err:            operationPreemptedError.Error(),
-			expectedResult: false,
-		},
-		{
-			desc:           "should return false if ConflictingUserInputError error is returned even if http status code == 2xx",
-			configAccepted: true,
-			err:            conflictingUserInputError.Error(),
-			expectedResult: false,
-		},
-	}
-	for i, test := range testCases {
-		tt := test
-		t.Run(tt.desc, func(t *testing.T) {
-			var future *azure.Future
-			if tt.configAccepted {
-				future = &acceptedFuture
-			} else {
-				future = &rejectedFuture
-			}
-			result := vmUpdateRequired(future, test.err)
-			assert.Equalf(t, test.expectedResult, result, "TestCase[%d] returned %v", i, result)
-		})
-	}
-}
-
-func TestConfigAccepted(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc           string
-		statusCode     int
-		expectedResult bool
-	}{
-		{
-			desc:           "should return true if HTTP status code is 2xx",
-			statusCode:     200,
-			expectedResult: true,
-		},
-		{
-			desc:           "should return false if HTTP status code is not 2xx",
-			statusCode:     400,
-			expectedResult: false,
-		},
-	}
-
-	for i, testCase := range testCases {
-		tt := testCase
-		t.Run(tt.desc, func(t *testing.T) {
-			r := autorestmocks.NewResponseWithStatus(strconv.Itoa(tt.statusCode), tt.statusCode)
-			r.Request.Method = http.MethodPut
-
-			future, _ := azure.NewFutureFromResponse(r)
-
-			result := configAccepted(&future)
-			assert.Equalf(t, tt.expectedResult, result, "TestCase[%d] returned %v", i, result)
-		})
-	}
-}
diff --git a/pkg/provider/azure_controller_vmss_test.go b/pkg/provider/azure_controller_vmss_test.go
index 96dbc3c30..9c1fdbe3f 100644
--- a/pkg/provider/azure_controller_vmss_test.go
+++ b/pkg/provider/azure_controller_vmss_test.go
@@ -95,7 +95,7 @@ func TestAttachDiskWithVMSS(t *testing.T) {
 		scaleSetName := string(test.vmssName)
 		ss, err := NewTestScaleSet(ctrl)
 		assert.NoError(t, err, test.desc)
-		testCloud := ss.cloud
+		testCloud := ss.Cloud
 		testCloud.PrimaryScaleSetName = scaleSetName
 		expectedVMSS := buildTestVMSSWithLB(scaleSetName, "vmss00-vm-", []string{testLBBackendpoolID0}, false)
 		mockVMSSClient := testCloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
@@ -224,7 +224,7 @@ func TestDetachDiskWithVMSS(t *testing.T) {
 		scaleSetName := strings.ToLower(string(test.vmssName))
 		ss, err := NewTestScaleSet(ctrl)
 		assert.NoError(t, err, test.desc)
-		testCloud := ss.cloud
+		testCloud := ss.Cloud
 		testCloud.PrimaryScaleSetName = scaleSetName
 		expectedVMSS := buildTestVMSSWithLB(scaleSetName, "vmss00-vm-", []string{testLBBackendpoolID0}, false)
 		mockVMSSClient := testCloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
@@ -354,7 +354,7 @@ func TestUpdateVMWithVMSS(t *testing.T) {
 		scaleSetName := strings.ToLower(string(test.vmssName))
 		ss, err := NewTestScaleSet(ctrl)
 		assert.NoError(t, err, test.desc)
-		testCloud := ss.cloud
+		testCloud := ss.Cloud
 		testCloud.PrimaryScaleSetName = scaleSetName
 		expectedVMSS := buildTestVMSSWithLB(scaleSetName, "vmss00-vm-", []string{testLBBackendpoolID0}, false)
 		mockVMSSClient := testCloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
@@ -476,7 +476,7 @@ func TestGetDataDisksWithVMSS(t *testing.T) {
 		scaleSetName := string(test.nodeName)
 		ss, err := NewTestScaleSet(ctrl)
 		assert.NoError(t, err, test.desc)
-		testCloud := ss.cloud
+		testCloud := ss.Cloud
 		testCloud.PrimaryScaleSetName = scaleSetName
 		expectedVMSS := buildTestVMSSWithLB(scaleSetName, "vmss00-vm-", []string{testLBBackendpoolID0}, false)
 		mockVMSSClient := testCloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
diff --git a/pkg/provider/azure_controller_vmssflex_test.go b/pkg/provider/azure_controller_vmssflex_test.go
index 49a898bf9..d76070572 100644
--- a/pkg/provider/azure_controller_vmssflex_test.go
+++ b/pkg/provider/azure_controller_vmssflex_test.go
@@ -99,7 +99,7 @@ func TestAttachDiskWithVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -197,7 +197,7 @@ func TestDettachDiskWithVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -259,7 +259,7 @@ func TestUpdateVMWithVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -329,7 +329,7 @@ func TestGetDataDisksWithVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -352,11 +352,10 @@ func TestVMSSFlexUpdateCache(t *testing.T) {
 	assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
 	testCases := []struct {
-		description        string
-		nodeName           string
-		vm                 *compute.VirtualMachine
-		disableUpdateCache bool
-		expectedErr        error
+		description string
+		nodeName    string
+		vm          *compute.VirtualMachine
+		expectedErr error
 	}{
 		{
 			description: "vm is nil",
@@ -389,15 +388,9 @@ func TestVMSSFlexUpdateCache(t *testing.T) {
 			},
 			expectedErr: fmt.Errorf("vm.OsProfile.ComputerName is nil"),
 		},
-		{
-			description:        "disableUpdateCache is set",
-			disableUpdateCache: true,
-			expectedErr:        nil,
-		},
 	}
 
 	for _, test := range testCases {
-		fs.DisableUpdateCache = test.disableUpdateCache
 		err = fs.updateCache(test.nodeName, test.vm)
 		assert.Equal(t, test.expectedErr, err, test.description)
 	}
diff --git a/pkg/provider/azure_instances_test.go b/pkg/provider/azure_instances_test.go
index 617c8ec8a..888761556 100644
--- a/pkg/provider/azure_instances_test.go
+++ b/pkg/provider/azure_instances_test.go
@@ -763,16 +763,16 @@ func TestInstanceExistsByProviderID(t *testing.T) {
 
 		mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 		mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-		ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 		expectedScaleSet := buildTestVMSS(test.scaleSet, test.scaleSet)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, test.rerr).AnyTimes()
 
-		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, "", 0, test.vmList, "succeeded", false)
+		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, test.scaleSet, "", 0, test.vmList, "succeeded", false)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, test.rerr).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		exist, _ := cloud.InstanceExistsByProviderID(context.Background(), test.providerID)
diff --git a/pkg/provider/azure_managedDiskController_test.go b/pkg/provider/azure_managedDiskController_test.go
deleted file mode 100644
index 5d2cf47f5..000000000
--- a/pkg/provider/azure_managedDiskController_test.go
+++ /dev/null
@@ -1,730 +0,0 @@
-/*
-Copyright 2020 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package provider
-
-import (
-	"context"
-	"fmt"
-	"strings"
-	"testing"
-
-	"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2022-08-01/compute"
-	"github.com/stretchr/testify/assert"
-	"go.uber.org/mock/gomock"
-
-	v1 "k8s.io/api/core/v1"
-	"k8s.io/apimachinery/pkg/api/resource"
-	cloudvolume "k8s.io/cloud-provider/volume"
-	"k8s.io/utils/pointer"
-
-	"sigs.k8s.io/cloud-provider-azure/pkg/azureclients/diskclient/mockdiskclient"
-	"sigs.k8s.io/cloud-provider-azure/pkg/consts"
-	"sigs.k8s.io/cloud-provider-azure/pkg/retry"
-)
-
-const (
-	fakeGetDiskFailed = "fakeGetDiskFailed"
-	disk1Name         = "disk1"
-	disk1ID           = "diskid1"
-)
-
-func TestCreateManagedDisk(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	maxShare := int32(2)
-	goodDiskEncryptionSetID := fmt.Sprintf("/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/diskEncryptionSets/%s", "diskEncryptionSet-name")
-	badDiskEncryptionSetID := "badDiskEncryptionSetID"
-	testTags := make(map[string]*string)
-	testTags[WriteAcceleratorEnabled] = pointer.String("true")
-	testCases := []struct {
-		desc                string
-		diskID              string
-		diskName            string
-		storageAccountType  compute.DiskStorageAccountTypes
-		diskIOPSReadWrite   string
-		diskMBPSReadWrite   string
-		diskEncryptionSetID string
-		diskEncryptionType  string
-		subscriptionID      string
-		resouceGroup        string
-		publicNetworkAccess compute.PublicNetworkAccess
-		networkAccessPolicy compute.NetworkAccessPolicy
-		diskAccessID        *string
-		expectedDiskID      string
-		existedDisk         compute.Disk
-		expectedErr         bool
-		expectedErrMsg      error
-	}{
-		{
-			desc:                "disk Id and no error shall be returned if everything is good with UltraSSDLRS storage account",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.UltraSSDLRS,
-			diskIOPSReadWrite:   "100",
-			diskMBPSReadWrite:   "100",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      disk1ID,
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         false,
-		},
-		{
-			desc:                "disk Id and no error shall be returned if everything is good with PremiumV2LRS storage account",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.PremiumV2LRS,
-			diskIOPSReadWrite:   "100",
-			diskMBPSReadWrite:   "100",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      disk1ID,
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         false,
-		},
-		{
-			desc:                "disk Id and no error shall be returned if everything is good with PremiumV2LRS storage account",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.PremiumV2LRS,
-			diskIOPSReadWrite:   "",
-			diskMBPSReadWrite:   "",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      disk1ID,
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         false,
-		},
-		{
-			desc:                "disk Id and no error shall be returned if everything is good with StandardLRS storage account",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskIOPSReadWrite:   "",
-			diskMBPSReadWrite:   "",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      disk1ID,
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         false,
-		},
-		{
-			desc:                "empty diskid and an error shall be returned if everything is good with UltraSSDLRS storage account but DiskIOPSReadWrite is invalid",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.UltraSSDLRS,
-			diskIOPSReadWrite:   "invalid",
-			diskMBPSReadWrite:   "100",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("AzureDisk - failed to parse DiskIOPSReadWrite: strconv.Atoi: parsing \"invalid\": invalid syntax"),
-		},
-		{
-			desc:                "empty diskid and an error shall be returned if everything is good with UltraSSDLRS storage account but DiskMBPSReadWrite is invalid",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.UltraSSDLRS,
-			diskIOPSReadWrite:   "100",
-			diskMBPSReadWrite:   "invalid",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("AzureDisk - failed to parse DiskMBpsReadWrite: strconv.Atoi: parsing \"invalid\": invalid syntax"),
-		},
-		{
-			desc:                "empty diskid and an error shall be returned if everything is good with UltraSSDLRS storage account with bad Disk EncryptionSetID",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.UltraSSDLRS,
-			diskIOPSReadWrite:   "100",
-			diskMBPSReadWrite:   "100",
-			diskEncryptionSetID: badDiskEncryptionSetID,
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("AzureDisk - format of DiskEncryptionSetID(%s) is incorrect, correct format: %s", badDiskEncryptionSetID, consts.DiskEncryptionSetIDFormat),
-		},
-		{
-			desc:                "DiskEncryptionType should be empty when DiskEncryptionSetID is not set",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskEncryptionSetID: "",
-			diskEncryptionType:  "EncryptionAtRestWithCustomerKey",
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("AzureDisk - DiskEncryptionType(EncryptionAtRestWithCustomerKey) should be empty when DiskEncryptionSetID is not set"),
-		},
-		{
-			desc:                "disk Id and no error shall be returned if everything is good with StandardLRS storage account with not empty diskIOPSReadWrite",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskIOPSReadWrite:   "100",
-			diskMBPSReadWrite:   "",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("AzureDisk - DiskIOPSReadWrite parameter is only applicable in UltraSSD_LRS disk type"),
-		},
-		{
-			desc:                "disk Id and no error shall be returned if everything is good with StandardLRS storage account with not empty diskMBPSReadWrite",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskIOPSReadWrite:   "",
-			diskMBPSReadWrite:   "100",
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("AzureDisk - DiskMBpsReadWrite parameter is only applicable in UltraSSD_LRS disk type"),
-		},
-		{
-			desc:                "correct NetworkAccessPolicy(DenyAll) setting",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			networkAccessPolicy: compute.DenyAll,
-			publicNetworkAccess: compute.Disabled,
-			expectedDiskID:      disk1ID,
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         false,
-		},
-		{
-			desc:                "correct NetworkAccessPolicy(AllowAll) setting",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			diskEncryptionType:  "EncryptionAtRestWithCustomerKey",
-			networkAccessPolicy: compute.AllowAll,
-			publicNetworkAccess: compute.Enabled,
-			expectedDiskID:      disk1ID,
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         false,
-		},
-		{
-			desc:                "DiskAccessID should not be empty when NetworkAccessPolicy is AllowPrivate",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			networkAccessPolicy: compute.AllowPrivate,
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("DiskAccessID should not be empty when NetworkAccessPolicy is AllowPrivate"),
-		},
-		{
-			desc:                "DiskAccessID(%s) must be empty when NetworkAccessPolicy(%s) is not AllowPrivate",
-			diskID:              disk1ID,
-			diskName:            disk1Name,
-			storageAccountType:  compute.StandardLRS,
-			diskEncryptionSetID: goodDiskEncryptionSetID,
-			networkAccessPolicy: compute.AllowAll,
-			diskAccessID:        pointer.String("diskAccessID"),
-			expectedDiskID:      "",
-			existedDisk:         compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:         true,
-			expectedErrMsg:      fmt.Errorf("DiskAccessID(diskAccessID) must be empty when NetworkAccessPolicy(AllowAll) is not AllowPrivate"),
-		},
-		{
-			desc:           "resourceGroup must be specified when subscriptionID is not empty",
-			diskID:         "",
-			diskName:       disk1Name,
-			subscriptionID: "abc",
-			resouceGroup:   "",
-			expectedDiskID: "",
-			existedDisk:    compute.Disk{ID: pointer.String(disk1ID), Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{Encryption: &compute.Encryption{DiskEncryptionSetID: &goodDiskEncryptionSetID, Type: compute.EncryptionTypeEncryptionAtRestWithCustomerKey}, ProvisioningState: pointer.String("Succeeded")}, Tags: testTags},
-			expectedErr:    true,
-			expectedErrMsg: fmt.Errorf("resourceGroup must be specified when subscriptionID(abc) is not empty"),
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		managedDiskController := testCloud.ManagedDiskController
-		volumeOptions := &ManagedDiskOptions{
-			DiskName:            test.diskName,
-			StorageAccountType:  test.storageAccountType,
-			ResourceGroup:       test.resouceGroup,
-			SizeGB:              1,
-			Tags:                map[string]string{"tag1": "azure-tag1"},
-			AvailabilityZone:    "westus-testzone",
-			DiskIOPSReadWrite:   test.diskIOPSReadWrite,
-			DiskMBpsReadWrite:   test.diskMBPSReadWrite,
-			DiskEncryptionSetID: test.diskEncryptionSetID,
-			DiskEncryptionType:  test.diskEncryptionType,
-			MaxShares:           maxShare,
-			NetworkAccessPolicy: test.networkAccessPolicy,
-			PublicNetworkAccess: test.publicNetworkAccess,
-			DiskAccessID:        test.diskAccessID,
-			SubscriptionID:      test.subscriptionID,
-		}
-
-		mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-		//disk := getTestDisk(test.diskName)
-		mockDisksClient.EXPECT().CreateOrUpdate(gomock.Any(), gomock.Any(), gomock.Any(), test.diskName, gomock.Any()).Return(nil).AnyTimes()
-		mockDisksClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any(), test.diskName).Return(test.existedDisk, nil).AnyTimes()
-
-		actualDiskID, err := managedDiskController.CreateManagedDisk(ctx, volumeOptions)
-		assert.Equal(t, test.expectedDiskID, actualDiskID, "TestCase[%d]: %s", i, test.desc)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
-		if test.expectedErr {
-			assert.EqualError(t, test.expectedErrMsg, err.Error(), "TestCase[%d]: %s, expected error: %v, return error: %v", i, test.desc, test.expectedErrMsg, err)
-		}
-	}
-}
-
-func TestCreateManagedDiskWithExtendedLocation(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCloud := GetTestCloudWithExtendedLocation(ctrl)
-	diskName := disk1Name
-	expectedDiskID := disk1ID
-	el := &compute.ExtendedLocation{
-		Name: pointer.String("microsoftlosangeles1"),
-		Type: compute.ExtendedLocationTypesEdgeZone,
-	}
-
-	diskreturned := compute.Disk{
-		ID:               pointer.String(expectedDiskID),
-		Name:             pointer.String(diskName),
-		ExtendedLocation: el,
-		DiskProperties: &compute.DiskProperties{
-			ProvisioningState: pointer.String("Succeeded"),
-		},
-	}
-
-	managedDiskController := testCloud.ManagedDiskController
-	volumeOptions := &ManagedDiskOptions{
-		DiskName:           diskName,
-		StorageAccountType: compute.PremiumLRS,
-		ResourceGroup:      "",
-		SizeGB:             1,
-		AvailabilityZone:   "westus-testzone",
-	}
-
-	mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-	mockDisksClient.EXPECT().CreateOrUpdate(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, diskName, gomock.Any()).
-		Do(func(ctx interface{}, subsID, rg, dn string, disk compute.Disk) {
-			assert.Equal(t, el.Name, disk.ExtendedLocation.Name, "The extended location name should match.")
-			assert.Equal(t, el.Type, disk.ExtendedLocation.Type, "The extended location type should match.")
-		}).Return(nil)
-
-	mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, diskName).Return(diskreturned, nil).AnyTimes()
-
-	actualDiskID, err := managedDiskController.CreateManagedDisk(ctx, volumeOptions)
-	assert.Equal(t, expectedDiskID, actualDiskID, "Disk ID does not match.")
-	assert.Nil(t, err, "There should not be an error.")
-}
-
-func TestDeleteManagedDisk(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCases := []struct {
-		desc           string
-		diskName       string
-		diskState      string
-		existedDisk    compute.Disk
-		expectedErr    bool
-		expectedErrMsg error
-	}{
-		{
-			desc:           "an error shall be returned if delete an attaching disk",
-			diskName:       disk1Name,
-			diskState:      "attaching",
-			existedDisk:    compute.Disk{Name: pointer.String(disk1Name)},
-			expectedErr:    true,
-			expectedErrMsg: fmt.Errorf("failed to delete disk(/subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/disks/disk1) since it's in attaching state"),
-		},
-		{
-			desc:        "no error shall be returned if everything is good",
-			diskName:    disk1Name,
-			existedDisk: compute.Disk{Name: pointer.String(disk1Name)},
-			expectedErr: false,
-		},
-		{
-			desc:           "an error shall be returned if get disk failed",
-			diskName:       fakeGetDiskFailed,
-			existedDisk:    compute.Disk{Name: pointer.String(fakeGetDiskFailed)},
-			expectedErr:    true,
-			expectedErrMsg: fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: Get Disk failed"),
-		},
-	}
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		managedDiskController := testCloud.ManagedDiskController
-		diskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-			testCloud.SubscriptionID, testCloud.ResourceGroup, *test.existedDisk.Name)
-		if test.diskState == "attaching" {
-			managedDiskController.diskStateMap.Store(strings.ToLower(diskURI), test.diskState)
-		}
-
-		mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-		if test.diskName == fakeGetDiskFailed {
-			mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, &retry.Error{RawError: fmt.Errorf("Get Disk failed")}).AnyTimes()
-		} else {
-			mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, nil).AnyTimes()
-		}
-		mockDisksClient.EXPECT().Delete(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName).Return(nil).AnyTimes()
-
-		err := managedDiskController.DeleteManagedDisk(ctx, diskURI)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
-		if test.expectedErr {
-			assert.EqualError(t, test.expectedErrMsg, err.Error(), "TestCase[%d]: %s, expected: %v, return: %v", i, test.desc, test.expectedErrMsg, err)
-		}
-	}
-}
-
-func TestGetDisk(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	testCases := []struct {
-		desc                      string
-		diskName                  string
-		existedDisk               compute.Disk
-		expectedErr               bool
-		expectedErrMsg            error
-		expectedProvisioningState string
-		expectedDiskID            string
-	}{
-		{
-			desc:                      "no error shall be returned if get a normal disk without DiskProperties",
-			diskName:                  disk1Name,
-			existedDisk:               compute.Disk{Name: pointer.String(disk1Name)},
-			expectedErr:               false,
-			expectedProvisioningState: "",
-			expectedDiskID:            "",
-		},
-		{
-			desc:                      "an error shall be returned if get disk failed",
-			diskName:                  fakeGetDiskFailed,
-			existedDisk:               compute.Disk{Name: pointer.String(fakeGetDiskFailed)},
-			expectedErr:               true,
-			expectedErrMsg:            fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: Get Disk failed"),
-			expectedProvisioningState: "",
-			expectedDiskID:            "",
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		managedDiskController := testCloud.ManagedDiskController
-
-		mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-		if test.diskName == fakeGetDiskFailed {
-			mockDisksClient.EXPECT().Get(gomock.Any(), "", testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, &retry.Error{RawError: fmt.Errorf("Get Disk failed")}).AnyTimes()
-		} else {
-			mockDisksClient.EXPECT().Get(gomock.Any(), "", testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, nil).AnyTimes()
-		}
-
-		provisioningState, diskid, err := managedDiskController.GetDisk(ctx, "", testCloud.ResourceGroup, test.diskName)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
-		if test.expectedErr {
-			assert.EqualError(t, test.expectedErrMsg, err.Error(), "TestCase[%d]: %s, expected: %v, return: %v", i, test.desc, test.expectedErrMsg, err)
-		}
-		assert.Equal(t, test.expectedProvisioningState, provisioningState, "TestCase[%d]: %s, expected ProvisioningState: %v, return ProvisioningState: %v", i, test.desc, test.expectedProvisioningState, provisioningState)
-		assert.Equal(t, test.expectedDiskID, diskid, "TestCase[%d]: %s, expected DiskID: %v, return DiskID: %v", i, test.desc, test.expectedDiskID, diskid)
-	}
-}
-
-func TestResizeDisk(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ctx, cancel := getContextWithCancel()
-	defer cancel()
-
-	diskSizeGB := int32(2)
-	diskName := disk1Name
-	fakeCreateDiskFailed := "fakeCreateDiskFailed"
-	testCases := []struct {
-		desc             string
-		diskName         string
-		oldSize          resource.Quantity
-		newSize          resource.Quantity
-		existedDisk      compute.Disk
-		expectedQuantity resource.Quantity
-		expectedErr      bool
-		expectedErrMsg   error
-	}{
-		{
-			desc:             "new quantity and no error shall be returned if everything is good",
-			diskName:         diskName,
-			oldSize:          *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			newSize:          *resource.NewQuantity(3*(1024*1024*1024), resource.BinarySI),
-			existedDisk:      compute.Disk{Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB, DiskState: compute.Unattached}},
-			expectedQuantity: *resource.NewQuantity(3*(1024*1024*1024), resource.BinarySI),
-			expectedErr:      false,
-		},
-		{
-			desc:             "new quantity and no error shall be returned if everything is good with DiskProperties is null",
-			diskName:         diskName,
-			oldSize:          *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			newSize:          *resource.NewQuantity(3*(1024*1024*1024), resource.BinarySI),
-			existedDisk:      compute.Disk{Name: pointer.String(disk1Name)},
-			expectedQuantity: *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			expectedErr:      true,
-			expectedErrMsg:   fmt.Errorf("DiskProperties of disk(%s) is nil", diskName),
-		},
-		{
-			desc:             "new quantity and no error shall be returned if everything is good with disk already of greater or equal size than requested",
-			diskName:         diskName,
-			oldSize:          *resource.NewQuantity(1*(1024*1024*1024), resource.BinarySI),
-			newSize:          *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			existedDisk:      compute.Disk{Name: pointer.String(disk1Name), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB, DiskState: compute.Unattached}},
-			expectedQuantity: *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			expectedErr:      false,
-		},
-		{
-			desc:             "an error shall be returned if everything is good but get disk failed",
-			diskName:         fakeGetDiskFailed,
-			oldSize:          *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			newSize:          *resource.NewQuantity(3*(1024*1024*1024), resource.BinarySI),
-			existedDisk:      compute.Disk{Name: pointer.String(fakeGetDiskFailed), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB, DiskState: compute.Unattached}},
-			expectedQuantity: *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			expectedErr:      true,
-			expectedErrMsg:   fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: Get Disk failed"),
-		},
-		{
-			desc:             "an error shall be returned if everything is good but create disk failed",
-			diskName:         fakeCreateDiskFailed,
-			oldSize:          *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			newSize:          *resource.NewQuantity(3*(1024*1024*1024), resource.BinarySI),
-			existedDisk:      compute.Disk{Name: pointer.String(fakeCreateDiskFailed), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB, DiskState: compute.Unattached}},
-			expectedQuantity: *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			expectedErr:      true,
-			expectedErrMsg:   fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: Create Disk failed"),
-		},
-		{
-			desc:             "an error shall be returned if disk is not in Unattached state",
-			diskName:         fakeCreateDiskFailed,
-			oldSize:          *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			newSize:          *resource.NewQuantity(3*(1024*1024*1024), resource.BinarySI),
-			existedDisk:      compute.Disk{Name: pointer.String(fakeCreateDiskFailed), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB, DiskState: compute.Attached}},
-			expectedQuantity: *resource.NewQuantity(2*(1024*1024*1024), resource.BinarySI),
-			expectedErr:      true,
-			expectedErrMsg:   fmt.Errorf("azureDisk - disk resize is only supported on Unattached disk, current disk state: Attached, already attached to "),
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		managedDiskController := testCloud.ManagedDiskController
-		diskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-			testCloud.SubscriptionID, testCloud.ResourceGroup, *test.existedDisk.Name)
-
-		mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-		if test.diskName == fakeGetDiskFailed {
-			mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, &retry.Error{RawError: fmt.Errorf("Get Disk failed")}).AnyTimes()
-		} else {
-			mockDisksClient.EXPECT().Get(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, nil).AnyTimes()
-		}
-		if test.diskName == fakeCreateDiskFailed {
-			mockDisksClient.EXPECT().Update(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName, gomock.Any()).Return(&retry.Error{RawError: fmt.Errorf("Create Disk failed")}).AnyTimes()
-		} else {
-			mockDisksClient.EXPECT().Update(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName, gomock.Any()).Return(nil).AnyTimes()
-		}
-
-		result, err := managedDiskController.ResizeDisk(ctx, diskURI, test.oldSize, test.newSize, false)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
-		if test.expectedErr {
-			assert.EqualError(t, test.expectedErrMsg, err.Error(), "TestCase[%d]: %s, expected: %v, return: %v", i, test.desc, test.expectedErrMsg, err)
-		}
-		assert.Equal(t, test.expectedQuantity.Value(), result.Value(), "TestCase[%d]: %s, expected Quantity: %v, return Quantity: %v", i, test.desc, test.expectedQuantity, result)
-	}
-}
-
-func TestGetLabelsForVolume(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	testCloud0 := GetTestCloud(ctrl)
-	diskName := disk1Name
-	diskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-		testCloud0.SubscriptionID, testCloud0.ResourceGroup, diskName)
-	diskSizeGB := int32(30)
-	fakeGetDiskFailedDiskURI := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/disks/%s",
-		testCloud0.SubscriptionID, testCloud0.ResourceGroup, fakeGetDiskFailed)
-	testCases := []struct {
-		desc           string
-		diskName       string
-		pv             *v1.PersistentVolume
-		existedDisk    compute.Disk
-		expected       map[string]string
-		expectedErr    bool
-		expectedErrMsg error
-	}{
-		{
-			desc:     "labels and no error shall be returned if everything is good",
-			diskName: diskName,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{
-						AzureDisk: &v1.AzureDiskVolumeSource{
-							DiskName:    diskName,
-							DataDiskURI: diskURI,
-						},
-					},
-				},
-			},
-			existedDisk: compute.Disk{Name: pointer.String(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}, Zones: &[]string{"1"}},
-			expected: map[string]string{
-				consts.LabelFailureDomainBetaRegion: testCloud0.Location,
-				consts.LabelFailureDomainBetaZone:   testCloud0.makeZone(testCloud0.Location, 1),
-			},
-			expectedErr: false,
-		},
-		{
-			desc:     "an error shall be returned if everything is good with invalid zone",
-			diskName: diskName,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{
-						AzureDisk: &v1.AzureDiskVolumeSource{
-							DiskName:    diskName,
-							DataDiskURI: diskURI,
-						},
-					},
-				},
-			},
-			existedDisk:    compute.Disk{Name: pointer.String(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}, Zones: &[]string{"invalid"}},
-			expectedErr:    true,
-			expectedErrMsg: fmt.Errorf("failed to parse zone [invalid] for AzureDisk %v: %v", diskName, "strconv.Atoi: parsing \"invalid\": invalid syntax"),
-		},
-		{
-			desc:     "nil shall be returned if everything is good with null Zones",
-			diskName: diskName,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{
-						AzureDisk: &v1.AzureDiskVolumeSource{
-							DiskName:    diskName,
-							DataDiskURI: diskURI,
-						},
-					},
-				},
-			},
-			existedDisk: compute.Disk{Name: pointer.String(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}},
-			expected: map[string]string{
-				consts.LabelFailureDomainBetaRegion: testCloud0.Location,
-			},
-			expectedErr:    false,
-			expectedErrMsg: nil,
-		},
-		{
-			desc:     "an error shall be returned if everything is good with get disk failed",
-			diskName: fakeGetDiskFailed,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{
-						AzureDisk: &v1.AzureDiskVolumeSource{
-							DiskName:    fakeGetDiskFailed,
-							DataDiskURI: fakeGetDiskFailedDiskURI,
-						},
-					},
-				},
-			},
-			existedDisk:    compute.Disk{Name: pointer.String(fakeGetDiskFailed), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}, Zones: &[]string{"1"}},
-			expectedErr:    true,
-			expectedErrMsg: fmt.Errorf("Retriable: false, RetryAfter: 0s, HTTPStatusCode: 0, RawError: Get Disk failed"),
-		},
-		{
-			desc:     "an error shall be returned if everything is good with invalid DiskURI",
-			diskName: diskName,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{
-						AzureDisk: &v1.AzureDiskVolumeSource{
-							DiskName:    diskName,
-							DataDiskURI: "invalidDiskURI",
-						},
-					},
-				},
-			},
-			existedDisk:    compute.Disk{Name: pointer.String(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}, Zones: &[]string{"1"}},
-			expectedErr:    true,
-			expectedErrMsg: fmt.Errorf("invalid disk URI: invalidDiskURI"),
-		},
-		{
-			desc:     "nil shall be returned if everything is good but pv.Spec.AzureDisk.DiskName is cloudvolume.ProvisionedVolumeName",
-			diskName: diskName,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{
-						AzureDisk: &v1.AzureDiskVolumeSource{
-							DiskName:    cloudvolume.ProvisionedVolumeName,
-							DataDiskURI: diskURI,
-						},
-					},
-				},
-			},
-			existedDisk: compute.Disk{Name: pointer.String(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}},
-			expected:    nil,
-			expectedErr: false,
-		},
-		{
-			desc:     "nil shall be returned if everything is good but pv.Spec.AzureDisk is nil",
-			diskName: diskName,
-			pv: &v1.PersistentVolume{
-				Spec: v1.PersistentVolumeSpec{
-					PersistentVolumeSource: v1.PersistentVolumeSource{},
-				},
-			},
-			existedDisk: compute.Disk{Name: pointer.String(diskName), DiskProperties: &compute.DiskProperties{DiskSizeGB: &diskSizeGB}},
-			expected:    nil,
-			expectedErr: false,
-		},
-	}
-
-	for i, test := range testCases {
-		testCloud := GetTestCloud(ctrl)
-		mockDisksClient := testCloud.DisksClient.(*mockdiskclient.MockInterface)
-		if test.diskName == fakeGetDiskFailed {
-			mockDisksClient.EXPECT().Get(gomock.Any(), testCloud.SubscriptionID, testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, &retry.Error{RawError: fmt.Errorf("Get Disk failed")}).AnyTimes()
-		} else {
-			mockDisksClient.EXPECT().Get(gomock.Any(), gomock.Any(), testCloud.ResourceGroup, test.diskName).Return(test.existedDisk, nil).AnyTimes()
-		}
-		mockDisksClient.EXPECT().CreateOrUpdate(gomock.Any(), "", testCloud.ResourceGroup, test.diskName, gomock.Any()).Return(nil).AnyTimes()
-
-		result, err := testCloud.GetLabelsForVolume(context.TODO(), test.pv)
-		assert.Equal(t, test.expected, result, "TestCase[%d]: %s, expected: %v, return: %v", i, test.desc, test.expected, result)
-		assert.Equal(t, test.expectedErr, err != nil, "TestCase[%d]: %s, return error: %v", i, test.desc, err)
-		if test.expectedErr {
-			assert.EqualError(t, test.expectedErrMsg, err.Error(), "TestCase[%d]: %s, expected: %v, return: %v", i, test.desc, test.expectedErrMsg, err)
-		}
-	}
-}
diff --git a/pkg/provider/azure_storageaccount_test.go b/pkg/provider/azure_storageaccount_test.go
index a6d2ac83d..8d7c6465b 100644
--- a/pkg/provider/azure_storageaccount_test.go
+++ b/pkg/provider/azure_storageaccount_test.go
@@ -626,8 +626,7 @@ func TestAddStorageAccountTags(t *testing.T) {
 	defer cancel()
 
 	cloud := &Cloud{}
-	_ = InitDiskControllers(cloud)
-
+	cloud.lockMap = newLockMap()
 	tests := []struct {
 		name           string
 		subsID         string
@@ -699,7 +698,6 @@ func TestRemoveStorageAccountTags(t *testing.T) {
 	defer cancel()
 
 	cloud := &Cloud{}
-	_ = InitDiskControllers(cloud)
 
 	tests := []struct {
 		name           string
@@ -732,7 +730,7 @@ func TestRemoveStorageAccountTags(t *testing.T) {
 
 	getter := func(key string) (interface{}, error) { return nil, nil }
 	cloud.storageAccountCache, _ = cache.NewTimedCache(time.Minute, getter, false)
-
+	cloud.lockMap = newLockMap()
 	for _, test := range tests {
 		mockStorageAccountsClient := mockstorageaccountclient.NewMockInterface(ctrl)
 		cloud.StorageAccountClient = mockStorageAccountsClient
diff --git a/pkg/provider/azure_test.go b/pkg/provider/azure_test.go
index e7ed602be..8b7ccfd40 100644
--- a/pkg/provider/azure_test.go
+++ b/pkg/provider/azure_test.go
@@ -2396,53 +2396,6 @@ func validateTestSubnet(t *testing.T, az *Cloud, svc *v1.Service) {
 		}, nil).AnyTimes()
 }
 
-func TestGetInfoFromDiskURI(t *testing.T) {
-	tests := []struct {
-		diskURL        string
-		expectedRG     string
-		expectedSubsID string
-		expectError    bool
-	}{
-		{
-			diskURL:        "/subscriptions/4be8920b-2978-43d7-axyz-04d8549c1d05/resourceGroups/azure-k8s1102/providers/Microsoft.Compute/disks/andy-mghyb1102-dynamic-pvc-f7f014c9-49f4-11e8-ab5c-000d3af7b38e",
-			expectedRG:     "azure-k8s1102",
-			expectedSubsID: "4be8920b-2978-43d7-axyz-04d8549c1d05",
-			expectError:    false,
-		},
-		{
-			// case insensitive check
-			diskURL:        "/subscriptions/4be8920b-2978-43d7-axyz-04d8549c1d05/resourcegroups/azure-k8s1102/providers/Microsoft.Compute/disks/andy-mghyb1102-dynamic-pvc-f7f014c9-49f4-11e8-ab5c-000d3af7b38e",
-			expectedRG:     "azure-k8s1102",
-			expectedSubsID: "4be8920b-2978-43d7-axyz-04d8549c1d05",
-			expectError:    false,
-		},
-		{
-			diskURL:     "/4be8920b-2978-43d7-axyz-04d8549c1d05/resourceGroups/azure-k8s1102/providers/Microsoft.Compute/disks/andy-mghyb1102-dynamic-pvc-f7f014c9-49f4-11e8-ab5c-000d3af7b38e",
-			expectedRG:  "",
-			expectError: true,
-		},
-		{
-			diskURL:     "",
-			expectedRG:  "",
-			expectError: true,
-		},
-	}
-
-	for _, test := range tests {
-		rg, subsID, err := getInfoFromDiskURI(test.diskURL)
-		assert.Equal(t, rg, test.expectedRG, "Expect result not equal with getInfoFromDiskURI(%s) return: %q, expected: %q",
-			test.diskURL, rg, test.expectedRG)
-		assert.Equal(t, subsID, test.expectedSubsID, "Expect result not equal with getInfoFromDiskURI(%s) return: %q, expected: %q",
-			test.diskURL, subsID, test.expectedSubsID)
-
-		if test.expectError {
-			assert.NotNil(t, err, "Expect error during getInfoFromDiskURI(%s)", test.diskURL)
-		} else {
-			assert.Nil(t, err, "Expect error is nil during getInfoFromDiskURI(%s)", test.diskURL)
-		}
-	}
-}
-
 func TestGetResourceGroups(t *testing.T) {
 	tests := []struct {
 		name               string
diff --git a/pkg/provider/azure_utils_test.go b/pkg/provider/azure_utils_test.go
index 78084fea1..ecd22b93b 100644
--- a/pkg/provider/azure_utils_test.go
+++ b/pkg/provider/azure_utils_test.go
@@ -67,7 +67,7 @@ func TestConcurrentLockEntry(t *testing.T) {
 	testLockMap.UnlockEntry("entry1")
 }
 
-func (lm *lockMap) lockAndCallback(_ *testing.T, entry string, callbackChan chan<- interface{}) {
+func (lm *LockMap) lockAndCallback(_ *testing.T, entry string, callbackChan chan<- interface{}) {
 	lm.LockEntry(entry)
 	callbackChan <- true
 }
diff --git a/pkg/provider/azure_vmss_cache_test.go b/pkg/provider/azure_vmss_cache_test.go
index c11393704..158e4e168 100644
--- a/pkg/provider/azure_vmss_cache_test.go
+++ b/pkg/provider/azure_vmss_cache_test.go
@@ -53,13 +53,13 @@ func TestVMSSVMCache(t *testing.T) {
 
 	mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 	mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-	ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-	ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+	ss.VirtualMachineScaleSetsClient = mockVMSSClient
+	ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 	expectedScaleSet := buildTestVMSS(testVMSSName, "vmssee6c2")
 	mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-	expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, vmList, "", false)
+	expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, vmList, "", false)
 	mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 
 	// validate getting VMSS VM via cache.
@@ -98,8 +98,8 @@ func TestVMSSVMCacheWithDeletingNodes(t *testing.T) {
 
 	mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 	mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-	ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-	ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+	ss.VirtualMachineScaleSetsClient = mockVMSSClient
+	ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 	expectedScaleSet := compute.VirtualMachineScaleSet{
 		Name:                             pointer.String(testVMSSName),
@@ -107,7 +107,7 @@ func TestVMSSVMCacheWithDeletingNodes(t *testing.T) {
 	}
 	mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-	expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, vmList, string(consts.ProvisioningStateDeleting), false)
+	expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, vmList, string(consts.ProvisioningStateDeleting), false)
 	mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 
 	for i := range expectedVMs {
@@ -131,13 +131,13 @@ func TestVMSSVMCacheClearedWhenRGDeleted(t *testing.T) {
 
 	mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 	mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-	ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-	ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+	ss.VirtualMachineScaleSetsClient = mockVMSSClient
+	ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 	expectedScaleSet := buildTestVMSS(testVMSSName, "vmssee6c2")
 	mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).Times(1)
 
-	expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, vmList, "", false)
+	expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, vmList, "", false)
 	mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).Times(1)
 
 	// validate getting VMSS VM via cache.
@@ -234,7 +234,7 @@ func TestGetVMManagementTypeByNodeName(t *testing.T) {
 		ss.DisableAvailabilitySetNodes = tc.DisableAvailabilitySetNodes
 		ss.EnableVmssFlexNodes = tc.EnableVmssFlexNodes
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVMList, tc.vmListErr).AnyTimes()
 
 		vmManagementType, err := ss.getVMManagementTypeByNodeName(tc.nodeName, azcache.CacheReadTypeDefault)
@@ -314,7 +314,7 @@ func TestGetVMManagementTypeByProviderID(t *testing.T) {
 		ss.DisableAvailabilitySetNodes = tc.DisableAvailabilitySetNodes
 		ss.EnableVmssFlexNodes = tc.EnableVmssFlexNodes
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVMList, tc.vmListErr).AnyTimes()
 
 		vmManagementType, err := ss.getVMManagementTypeByProviderID(tc.providerID, azcache.CacheReadTypeDefault)
@@ -431,7 +431,7 @@ func TestGetVMManagementTypeByIPConfigurationID(t *testing.T) {
 		ss.DisableAvailabilitySetNodes = tc.DisableAvailabilitySetNodes
 		ss.EnableVmssFlexNodes = tc.EnableVmssFlexNodes
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVMList, tc.vmListErr).AnyTimes()
 
 		if tc.expectedNIC != "" {
@@ -458,32 +458,3 @@ func TestGetVMManagementTypeByIPConfigurationID(t *testing.T) {
 
 	}
 }
-
-func TestVMSSUpdateCache(t *testing.T) {
-	ctrl := gomock.NewController(t)
-	defer ctrl.Finish()
-
-	ss, err := NewTestScaleSet(ctrl)
-	assert.NoError(t, err, "unexpected error when creating test ScaleSet")
-
-	testCases := []struct {
-		description                 string
-		nodeName, resourceGroupName string
-		vmssName, instanceID        string
-		vm                          *compute.VirtualMachineScaleSetVM
-		disableUpdateCache          bool
-		expectedErr                 error
-	}{
-		{
-			description:        "disableUpdateCache is set",
-			disableUpdateCache: true,
-			expectedErr:        nil,
-		},
-	}
-
-	for _, test := range testCases {
-		ss.DisableUpdateCache = test.disableUpdateCache
-		err = ss.updateCache(test.nodeName, test.nodeName, test.resourceGroupName, test.instanceID, test.vm)
-		assert.Equal(t, test.expectedErr, err, test.description)
-	}
-}
diff --git a/pkg/provider/azure_vmss_test.go b/pkg/provider/azure_vmss_test.go
index d3ed025d7..4617023e9 100644
--- a/pkg/provider/azure_vmss_test.go
+++ b/pkg/provider/azure_vmss_test.go
@@ -319,16 +319,16 @@ func TestGetNodeIdentityByNodeName(t *testing.T) {
 
 		mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 		mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-		ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 		expectedScaleSet := buildTestVMSS(test.scaleSet, test.computerName)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, "", 0, test.vmList, "", false)
+		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, test.scaleSet, "", 0, test.vmList, "", false)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		nodeID, err := ss.getNodeIdentityByNodeName(test.nodeName, azcache.CacheReadTypeDefault)
@@ -383,16 +383,16 @@ func TestGetInstanceIDByNodeName(t *testing.T) {
 
 		mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 		mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-		ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 		expectedScaleSet := buildTestVMSS(test.scaleSet, "vmssee6c2")
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, "", 0, test.vmList, "", false)
+		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, test.scaleSet, "", 0, test.vmList, "", false)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		realValue, err := ss.GetInstanceIDByNodeName(test.nodeName)
@@ -468,16 +468,16 @@ func TestGetZoneByNodeName(t *testing.T) {
 
 		mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 		mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-		ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 		expectedScaleSet := buildTestVMSS(test.scaleSet, "vmssee6c2")
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, test.zone, test.faultDomain, test.vmList, "", false)
+		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, test.scaleSet, test.zone, test.faultDomain, test.vmList, "", false)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		realValue, err := ss.GetZoneByNodeName(test.nodeName)
@@ -528,20 +528,20 @@ func TestGetIPByNodeName(t *testing.T) {
 		mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
 		mockInterfaceClient := mockinterfaceclient.NewMockInterface(ctrl)
 		mockPIPClient := mockpublicipclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-		ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
-		ss.cloud.InterfacesClient = mockInterfaceClient
-		ss.cloud.PublicIPAddressesClient = mockPIPClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+		ss.InterfacesClient = mockInterfaceClient
+		ss.PublicIPAddressesClient = mockPIPClient
 
 		expectedScaleSet := buildTestVMSS(test.scaleSet, "vmssee6c2")
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-		expectedVMs, expectedInterface, expectedPIP := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, "", 0, test.vmList, "", false)
+		expectedVMs, expectedInterface, expectedPIP := buildTestVirtualMachineEnv(ss.Cloud, test.scaleSet, "", 0, test.vmList, "", false)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 		mockInterfaceClient.EXPECT().GetVirtualMachineScaleSetNetworkInterface(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedInterface, nil).AnyTimes()
 		mockPIPClient.EXPECT().GetVirtualMachineScaleSetPublicIPAddress(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedPIP, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		privateIP, publicIP, err := ss.GetIPByNodeName(test.nodeName)
@@ -600,16 +600,16 @@ func TestGetNodeNameByIPConfigurationID(t *testing.T) {
 
 		mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
 		mockVMSSVMClient := mockvmssvmclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
-		ss.cloud.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetVMsClient = mockVMSSVMClient
 
 		expectedScaleSet := buildTestVMSS(test.scaleSet, "vmssee6c2")
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{expectedScaleSet}, nil).AnyTimes()
 
-		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.scaleSet, "", 0, test.vmList, "", false)
+		expectedVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, test.scaleSet, "", 0, test.vmList, "", false)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(expectedVMs, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		nodeName, scalesetName, err := ss.GetNodeNameByIPConfigurationID(test.ipConfigurationID)
@@ -698,7 +698,7 @@ func TestGetVMSS(t *testing.T) {
 		assert.NoError(t, err, test.description)
 
 		mockVMSSClient := mockvmssclient.NewMockInterface(ctrl)
-		ss.cloud.VirtualMachineScaleSetsClient = mockVMSSClient
+		ss.VirtualMachineScaleSetsClient = mockVMSSClient
 
 		expected := compute.VirtualMachineScaleSet{
 			Name: pointer.String(test.existedVMSSName),
@@ -749,10 +749,10 @@ func TestGetVmssVM(t *testing.T) {
 		assert.NoError(t, err, test.description)
 
 		expectedVMSS := buildTestVMSS(test.existedVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, test.existedVMSSName, "", 0, test.existedNodeNames, "", false)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, test.existedVMSSName, "", 0, test.existedNodeNames, "", false)
 		var expectedVMSSVM compute.VirtualMachineScaleSetVM
 		for _, expected := range expectedVMSSVMs {
 			if strings.EqualFold(*expected.OsProfile.ComputerName, test.nodeName) {
@@ -760,7 +760,7 @@ func TestGetVmssVM(t *testing.T) {
 			}
 		}
 
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, test.existedVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
 		vmssVM, err := ss.getVmssVM(test.nodeName, azcache.CacheReadTypeDefault)
@@ -800,17 +800,17 @@ func TestGetPowerStatusByNodeName(t *testing.T) {
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		if test.nilStatus {
 			expectedVMSSVMs[0].InstanceView.Statuses = nil
 		}
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		powerState, err := ss.GetPowerStatusByNodeName("vmss-vm-000001")
@@ -849,11 +849,11 @@ func TestGetProvisioningStateByNodeName(t *testing.T) {
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		if test.provisioningState != "" {
 			expectedVMSSVMs[0].ProvisioningState = pointer.String(test.provisioningState)
 		} else {
@@ -861,7 +861,7 @@ func TestGetProvisioningStateByNodeName(t *testing.T) {
 		}
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		provisioningState, err := ss.GetProvisioningStateByNodeName("vmss-vm-000001")
@@ -897,11 +897,11 @@ func TestGetVmssVMByInstanceID(t *testing.T) {
 				VirtualMachineProfile: &compute.VirtualMachineScaleSetVMProfile{},
 			},
 		}
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
 		vm, err := ss.getVmssVMByInstanceID(ss.ResourceGroup, testVMSSName, test.instanceID, azcache.CacheReadTypeDefault)
@@ -946,11 +946,11 @@ func TestGetVmssVMByNodeIdentity(t *testing.T) {
 					VirtualMachineProfile: &compute.VirtualMachineScaleSetVMProfile{},
 				},
 			}
-			mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+			mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 			mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-			expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
-			mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+			expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
+			mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 			mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
 			cacheKey := getVMSSVMCacheKey(ss.ResourceGroup, testVMSSName)
@@ -1018,14 +1018,14 @@ func TestGetInstanceTypeByNodeName(t *testing.T) {
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, test.vmClientErr).AnyTimes()
 
 		sku, err := ss.GetInstanceTypeByNodeName("vmss-vm-000000")
@@ -1182,10 +1182,10 @@ func TestGetPrimaryInterface(t *testing.T) {
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, test.vmssClientErr).AnyTimes()
 
-		expectedVMSSVMs, expectedInterface, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
+		expectedVMSSVMs, expectedInterface, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
 		if !test.hasPrimaryInterface {
 			networkInterfaces := *expectedVMSSVMs[0].NetworkProfile.NetworkInterfaces
 			networkInterfaces[0].Primary = pointer.Bool(false)
@@ -1199,13 +1199,13 @@ func TestGetPrimaryInterface(t *testing.T) {
 			networkInterfaces[0].ID = pointer.String("invalid/id/")
 			expectedVMSSVMs[0].NetworkProfile.NetworkInterfaces = &networkInterfaces
 		}
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, test.vmClientErr).AnyTimes()
 
-		mockInterfaceClient := ss.cloud.InterfacesClient.(*mockinterfaceclient.MockInterface)
+		mockInterfaceClient := ss.InterfacesClient.(*mockinterfaceclient.MockInterface)
 		mockInterfaceClient.EXPECT().GetVirtualMachineScaleSetNetworkInterface(gomock.Any(), ss.ResourceGroup, testVMSSName, "0", test.nodeName, gomock.Any()).Return(expectedInterface, test.nicClientErr).AnyTimes()
 		expectedInterface.Location = &ss.Location
 
@@ -1255,7 +1255,7 @@ func TestGetVMSSPublicIPAddress(t *testing.T) {
 		ss, err := NewTestScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
-		mockPIPClient := ss.cloud.PublicIPAddressesClient.(*mockpublicipclient.MockInterface)
+		mockPIPClient := ss.PublicIPAddressesClient.(*mockpublicipclient.MockInterface)
 		mockPIPClient.EXPECT().GetVirtualMachineScaleSetPublicIPAddress(gomock.Any(), ss.ResourceGroup, testVMSSName, "0", "nic", "ip", "pip", "").Return(network.PublicIPAddress{}, test.pipClientErr).AnyTimes()
 		mockPIPClient.EXPECT().GetVirtualMachineScaleSetPublicIPAddress(gomock.Any(), ss.ResourceGroup, testVMSSName, "0", "nic", "ip", gomock.Not("pip"), "").Return(network.PublicIPAddress{}, &retry.Error{HTTPStatusCode: 404, RawError: fmt.Errorf("not found")}).AnyTimes()
 
@@ -1309,21 +1309,21 @@ func TestGetPrivateIPsByNodeName(t *testing.T) {
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
-		expectedVMSSVMs, expectedInterface, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, test.vmList, "", false)
+		expectedVMSSVMs, expectedInterface, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, test.vmList, "", false)
 
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, test.vmClientErr).AnyTimes()
 
 		if test.isNilIPConfigs {
 			expectedInterface.IPConfigurations = nil
 		}
-		mockInterfaceClient := ss.cloud.InterfacesClient.(*mockinterfaceclient.MockInterface)
+		mockInterfaceClient := ss.InterfacesClient.(*mockinterfaceclient.MockInterface)
 		mockInterfaceClient.EXPECT().GetVirtualMachineScaleSetNetworkInterface(gomock.Any(), ss.ResourceGroup, testVMSSName, "0", test.nodeName, gomock.Any()).Return(expectedInterface, nil).AnyTimes()
 
 		privateIPs, err := ss.GetPrivateIPsByNodeName(test.nodeName)
@@ -1386,7 +1386,7 @@ func TestListScaleSetVMs(t *testing.T) {
 		ss, err := NewTestScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test VMSS")
 
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(test.existedVMSSVMs, test.vmssVMClientErr).AnyTimes()
 
 		expectedVMSSVMs := test.existedVMSSVMs
@@ -1460,7 +1460,7 @@ func TestGetAgentPoolScaleSets(t *testing.T) {
 		ss.excludeLoadBalancerNodes = sets.New(test.excludeLBNodes...)
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
 		expectedVMSSVMs := []compute.VirtualMachineScaleSetVM{
@@ -1489,10 +1489,10 @@ func TestGetAgentPoolScaleSets(t *testing.T) {
 				},
 			},
 		}
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
 
 		vmssNames, err := ss.getAgentPoolScaleSets(test.nodes)
@@ -1593,7 +1593,7 @@ func TestGetVMSetNames(t *testing.T) {
 		}
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
 		expectedVMSSVMs := []compute.VirtualMachineScaleSetVM{
@@ -1627,10 +1627,10 @@ func TestGetVMSetNames(t *testing.T) {
 				},
 			},
 		}
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
 
 		vmSetNames, err := ss.GetVMSetNames(test.service, test.nodes)
@@ -2190,7 +2190,7 @@ func TestEnsureHostInPool(t *testing.T) {
 		}
 
 		expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
 		provisionState := ""
@@ -2198,7 +2198,7 @@ func TestEnsureHostInPool(t *testing.T) {
 			provisionState = "Deleting"
 		}
 		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(
-			ss.cloud,
+			ss.Cloud,
 			testVMSSName,
 			"",
 			0,
@@ -2209,7 +2209,7 @@ func TestEnsureHostInPool(t *testing.T) {
 		if test.isNilVMNetworkConfigs {
 			expectedVMSSVMs[0].NetworkProfileConfiguration.NetworkInterfaceConfigurations = nil
 		}
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(
 			gomock.Any(),
 			ss.ResourceGroup,
@@ -2443,7 +2443,7 @@ func TestEnsureVMSSInPool(t *testing.T) {
 			if test.isVMSSNilNICConfig {
 				expectedVMSS.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = nil
 			}
-			mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+			mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 			mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 			vmssPutTimes := 0
 			if test.expectedPutVMSS {
@@ -2452,8 +2452,8 @@ func TestEnsureVMSSInPool(t *testing.T) {
 			}
 			mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(nil).Times(vmssPutTimes)
 
-			expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, []string{"vmss-vm-000000"}, "", test.setIPv6Config)
-			mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+			expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, []string{"vmss-vm-000000"}, "", test.setIPv6Config)
+			mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 			mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
 			if test.expectedGetInstanceID != "" {
@@ -2541,17 +2541,17 @@ func TestEnsureHostsInPool(t *testing.T) {
 		ss.ExcludeMasterFromStandardLB = pointer.Bool(true)
 
 		expectedVMSS := buildTestVMSSWithLB(testVMSSName, "vmss-vm-", []string{testLBBackendpoolID0}, false)
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 		mockVMSSClient.EXPECT().Get(gomock.Any(), ss.ResourceGroup, testVMSSName).Return(expectedVMSS, nil).MaxTimes(1)
 		mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(nil).MaxTimes(1)
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, []string{"vmss-vm-000000", "vmss-vm-000001", "vmss-vm-000002"}, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, []string{"vmss-vm-000000", "vmss-vm-000001", "vmss-vm-000002"}, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 		mockVMSSVMClient.EXPECT().UpdateVMs(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).Times(test.expectedVMSSVMPutTimes)
 
-		mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
 
 		err = ss.EnsureHostsInPool(&v1.Service{}, test.nodes, test.backendpoolID, test.vmSetName)
@@ -2638,15 +2638,15 @@ func TestEnsureBackendPoolDeletedFromNodeCommon(t *testing.T) {
 			assert.NoError(t, err, test.description)
 
 			expectedVMSS := buildTestVMSS(testVMSSName, "vmss-vm-")
-			mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+			mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 			mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 
 			// isIPv6 true means it is a DualStack or IPv6 only cluster.
-			expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, []string{"vmss-vm-000000"}, "", true)
+			expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, []string{"vmss-vm-000000"}, "", true)
 			if test.isNilVMNetworkConfigs {
 				expectedVMSSVMs[0].NetworkProfileConfiguration.NetworkInterfaceConfigurations = nil
 			}
-			mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+			mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 			mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
 			nodeResourceGroup, ssName, instanceID, vm, err := ss.ensureBackendPoolDeletedFromNode(test.nodeName, test.backendpoolIDs)
@@ -2734,7 +2734,7 @@ func TestEnsureBackendPoolDeletedFromVMSS(t *testing.T) {
 		if test.isVMSSNilVirtualMachineProfile {
 			expectedVMSS.VirtualMachineProfile = nil
 		}
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes().MinTimes(1)
 		vmssPutTimes := 0
 		if test.expectedPutVMSS {
@@ -2743,8 +2743,8 @@ func TestEnsureBackendPoolDeletedFromVMSS(t *testing.T) {
 		}
 		mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(test.vmssClientErr).Times(vmssPutTimes)
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, []string{"vmss-vm-000000"}, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, []string{"vmss-vm-000000"}, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 
 		err = ss.ensureBackendPoolDeletedFromVMSS([]string{test.backendPoolID}, testVMSSName)
@@ -2844,17 +2844,17 @@ func TestEnsureBackendPoolDeleted(t *testing.T) {
 		assert.NoError(t, err, test.description)
 
 		expectedVMSS := buildTestVMSSWithLB(testVMSSName, "vmss-vm-", []string{testLBBackendpoolID0}, false)
-		mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).AnyTimes()
 		mockVMSSClient.EXPECT().Get(gomock.Any(), ss.ResourceGroup, testVMSSName).Return(expectedVMSS, nil).MaxTimes(1)
 		mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(nil).Times(1)
 
-		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, []string{"vmss-vm-000000", "vmss-vm-000001", "vmss-vm-000002"}, "", false)
-		mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+		expectedVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, []string{"vmss-vm-000000", "vmss-vm-000001", "vmss-vm-000002"}, "", false)
+		mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 		mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any()).Return(expectedVMSSVMs, nil).AnyTimes()
 		mockVMSSVMClient.EXPECT().UpdateVMs(gomock.Any(), ss.ResourceGroup, testVMSSName, gomock.Any(), gomock.Any(), gomock.Any()).Return(test.vmClientErr).Times(test.expectedVMSSVMPutTimes)
 
-		mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+		mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 		mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 		updated, err := ss.EnsureBackendPoolDeleted(&v1.Service{}, []string{test.backendpoolID}, testVMSSName, test.backendAddressPools, true)
@@ -2918,8 +2918,8 @@ func TestEnsureBackendPoolDeletedConcurrently(t *testing.T) {
 	vmss0 := buildTestVMSSWithLB("vmss-0", "vmss-0-vm-", []string{testLBBackendpoolID0, testLBBackendpoolID1}, false)
 	vmss1 := buildTestVMSSWithLB("vmss-1", "vmss-1-vm-", []string{testLBBackendpoolID0, testLBBackendpoolID1}, false)
 
-	expectedVMSSVMsOfVMSS0, _, _ := buildTestVirtualMachineEnv(ss.cloud, "vmss-0", "", 0, []string{"vmss-0-vm-000000"}, "succeeded", false)
-	expectedVMSSVMsOfVMSS1, _, _ := buildTestVirtualMachineEnv(ss.cloud, "vmss-1", "", 0, []string{"vmss-1-vm-000001"}, "succeeded", false)
+	expectedVMSSVMsOfVMSS0, _, _ := buildTestVirtualMachineEnv(ss.Cloud, "vmss-0", "", 0, []string{"vmss-0-vm-000000"}, "succeeded", false)
+	expectedVMSSVMsOfVMSS1, _, _ := buildTestVirtualMachineEnv(ss.Cloud, "vmss-1", "", 0, []string{"vmss-1-vm-000001"}, "succeeded", false)
 	for _, expectedVMSSVMs := range [][]compute.VirtualMachineScaleSetVM{expectedVMSSVMsOfVMSS0, expectedVMSSVMsOfVMSS1} {
 		vmssVMNetworkConfigs := expectedVMSSVMs[0].NetworkProfileConfiguration
 		vmssVMIPConfigs := (*vmssVMNetworkConfigs.NetworkInterfaceConfigurations)[0].VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations
@@ -2927,17 +2927,17 @@ func TestEnsureBackendPoolDeletedConcurrently(t *testing.T) {
 		*lbBackendpools = append(*lbBackendpools, compute.SubResource{ID: pointer.String(testLBBackendpoolID1)})
 	}
 
-	mockVMClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+	mockVMClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 	mockVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
-	mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+	mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 	mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{vmss0, vmss1}, nil).AnyTimes()
 	mockVMSSClient.EXPECT().List(gomock.Any(), "rg1").Return(nil, nil).AnyTimes()
 	mockVMSSClient.EXPECT().Get(gomock.Any(), ss.ResourceGroup, "vmss-0").Return(vmss0, nil).MaxTimes(2)
 	mockVMSSClient.EXPECT().Get(gomock.Any(), ss.ResourceGroup, "vmss-1").Return(vmss1, nil).MaxTimes(2)
 	mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), ss.ResourceGroup, gomock.Any(), gomock.Any()).Return(nil).Times(2)
 
-	mockVMSSVMClient := ss.cloud.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
+	mockVMSSVMClient := ss.VirtualMachineScaleSetVMsClient.(*mockvmssvmclient.MockInterface)
 	mockVMSSVMClient.EXPECT().List(gomock.Any(), "rg1", "vmss-0", gomock.Any()).Return(nil, nil).AnyTimes()
 	mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, "vmss-0", gomock.Any()).Return(expectedVMSSVMsOfVMSS0, nil).AnyTimes()
 	mockVMSSVMClient.EXPECT().List(gomock.Any(), ss.ResourceGroup, "vmss-1", gomock.Any()).Return(expectedVMSSVMsOfVMSS1, nil).AnyTimes()
@@ -3013,10 +3013,10 @@ func TestGetNodeCIDRMasksByProviderID(t *testing.T) {
 					OrchestrationMode: compute.Uniform,
 				},
 			}
-			mockVMSSClient := ss.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+			mockVMSSClient := ss.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 			mockVMSSClient.EXPECT().List(gomock.Any(), ss.ResourceGroup).Return([]compute.VirtualMachineScaleSet{expectedVMSS}, nil).MaxTimes(1)
 
-			mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+			mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 			mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 			ipv4MaskSize, ipv6MaskSize, err := ss.GetNodeCIDRMasksByProviderID(tc.providerID)
@@ -3060,7 +3060,7 @@ func TestGetAgentPoolVMSetNamesMixedInstances(t *testing.T) {
 	}
 	expectedScaleSet := buildTestVMSS(testVMSSName, "vmssee6c2")
 	vmList := []string{"vmssee6c2000000", "vmssee6c2000001", "vmssee6c2000002"}
-	existingVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.cloud, testVMSSName, "", 0, vmList, "", false)
+	existingVMSSVMs, _, _ := buildTestVirtualMachineEnv(ss.Cloud, testVMSSName, "", 0, vmList, "", false)
 
 	mockVMClient := ss.Cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
 	mockVMClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(existingVMs, nil).AnyTimes()
@@ -3102,7 +3102,7 @@ func TestGetNodeVMSetNameVMSS(t *testing.T) {
 	ss, err := NewTestScaleSet(ctrl)
 	assert.NoError(t, err)
 
-	mockVMsClient := ss.cloud.VirtualMachinesClient.(*mockvmclient.MockInterface)
+	mockVMsClient := ss.VirtualMachinesClient.(*mockvmclient.MockInterface)
 	mockVMsClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachine{}, nil).AnyTimes()
 
 	vmSetName, err := ss.GetNodeVMSetName(node)
diff --git a/pkg/provider/azure_vmssflex_cache_test.go b/pkg/provider/azure_vmssflex_cache_test.go
index e06e868c3..90d151432 100644
--- a/pkg/provider/azure_vmssflex_cache_test.go
+++ b/pkg/provider/azure_vmssflex_cache_test.go
@@ -261,7 +261,7 @@ func TestGetNodeNameByVMName(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -311,7 +311,7 @@ func TestGetNodeVmssFlexID(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -377,7 +377,7 @@ func TestGetVmssFlexVM(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -433,7 +433,7 @@ func TestGetVmssFlexByVmssFlexID(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(tc.testVmssFlexList, tc.vmssFlexListErr).AnyTimes()
 
 		vmssFlex, err := fs.getVmssFlexByVmssFlexID(tc.vmssFlexID, azcache.CacheReadTypeDefault)
@@ -486,7 +486,7 @@ func TestGetVmssFlexIDByName(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(tc.testVmssFlexList, tc.vmssFlexListErr).AnyTimes()
 
 		vmssFlexID, err := fs.getVmssFlexIDByName(tc.vmssFlexName)
@@ -541,7 +541,7 @@ func TestGetVmssFlexByName(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(tc.testVmssFlexList, tc.vmssFlexListErr).AnyTimes()
 
 		vmssFlex, err := fs.getVmssFlexByName(tc.vmssFlexName)
@@ -594,7 +594,7 @@ func TestGetVmssFlexByNodeName(t *testing.T) {
 		mockVMClient.EXPECT().Get(gomock.Any(), fs.ResourceGroup, tc.nodeName, gomock.Any()).Return(tc.testVM, tc.vmGetErr).AnyTimes()
 		mockVMClient.EXPECT().ListVmssFlexVMsWithoutInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithoutInstanceView, tc.vmListErr).AnyTimes()
 		mockVMClient.EXPECT().ListVmssFlexVMsWithOnlyInstanceView(gomock.Any(), gomock.Any()).Return(tc.testVMListWithOnlyInstanceView, tc.vmListErr).AnyTimes()
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(tc.testVmssFlexList, tc.vmssFlexListErr).AnyTimes()
 
 		vmssFlex, err := fs.getVmssFlexByNodeName(tc.nodeName, azcache.CacheReadTypeDefault)
diff --git a/pkg/provider/azure_vmssflex_test.go b/pkg/provider/azure_vmssflex_test.go
index e5005d47e..b508ba037 100644
--- a/pkg/provider/azure_vmssflex_test.go
+++ b/pkg/provider/azure_vmssflex_test.go
@@ -271,7 +271,7 @@ func TestGetNodeNameByProviderIDVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -322,7 +322,7 @@ func TestGetInstanceIDByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -372,7 +372,7 @@ func TestGetInstanceTypeByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -446,7 +446,7 @@ func TestGetZoneByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -506,7 +506,7 @@ func TestGetProvisioningStateByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -566,7 +566,7 @@ func TestGetPowerStatusByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -634,7 +634,7 @@ func TestGetPrimaryInterfaceVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -686,7 +686,7 @@ func TestGetIPByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -747,7 +747,7 @@ func TestGetPrivateIPsByNodeNameVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -817,7 +817,7 @@ func TestGetNodeNameByIPConfigurationIDVmssFlex(t *testing.T) {
 		fs, err := NewTestFlexScaleSet(ctrl)
 		assert.NoError(t, err, "unexpected error when creating test FlexScaleSet")
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -916,7 +916,7 @@ func TestGetNodeCIDRMasksByProviderIDVmssFlex(t *testing.T) {
 		if tc.tags != nil {
 			testVmssFlexList[0].Tags = tc.tags
 		}
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -1100,7 +1100,7 @@ func TestEnsureHostInPoolVmssFlex(t *testing.T) {
 			fs.Config.LoadBalancerSku = consts.LoadBalancerSkuStandard
 		}
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(testVmssFlexList, nil).AnyTimes()
 
 		mockVMClient := fs.VirtualMachinesClient.(*mockvmclient.MockInterface)
@@ -1257,7 +1257,7 @@ func TestEnsureVMSSFlexInPool(t *testing.T) {
 		}
 		expectedestVmssFlexList := []compute.VirtualMachineScaleSet{testVmssFlex}
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(expectedestVmssFlexList, nil).AnyTimes()
 		mockVMSSClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(testVmssFlex1, nil).AnyTimes()
 		mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(tc.vmssPutErr).AnyTimes()
@@ -1364,7 +1364,7 @@ func TestEnsureHostsInPoolVmssFlex(t *testing.T) {
 			fs.Config.LoadBalancerSku = consts.LoadBalancerSkuStandard
 		}
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return([]compute.VirtualMachineScaleSet{genreteTestVmssFlex("vmssflex1", testVmssFlex1ID)}, nil).AnyTimes()
 		mockVMSSClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(testVmssFlex1, nil).AnyTimes()
 		mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(tc.vmssPutErr).AnyTimes()
@@ -1514,7 +1514,7 @@ func TestEnsureBackendPoolDeletedFromVMSetsVmssFlex(t *testing.T) {
 
 			vmssFlexList := []compute.VirtualMachineScaleSet{testVmssFlex}
 
-			mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+			mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 			mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(vmssFlexList, nil).Times(tc.vmssListCallingTimes)
 			mockVMSSClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(testVmssFlex1, nil).AnyTimes()
 			mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(tc.vmssPutErr).AnyTimes()
@@ -1702,7 +1702,7 @@ func TestEnsureBackendPoolDeletedVmssFlex(t *testing.T) {
 		testVmssFlex := genreteTestVmssFlex("vmssflex1", testVmssFlex1ID)
 		vmssFlexList := []compute.VirtualMachineScaleSet{testVmssFlex, genreteTestVmssFlex("vmssflex2", testVmssFlex2ID)}
 
-		mockVMSSClient := fs.cloud.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
+		mockVMSSClient := fs.VirtualMachineScaleSetsClient.(*mockvmssclient.MockInterface)
 		mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).Return(vmssFlexList, nil).AnyTimes()
 		mockVMSSClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(testVmssFlex1, nil).AnyTimes()
 		mockVMSSClient.EXPECT().CreateOrUpdate(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(tc.vmssPutErr).AnyTimes()