diff --git a/pkg/azuredisk/controllerserver.go b/pkg/azuredisk/controllerserver.go index 73224b575a..6d37b7e015 100644 --- a/pkg/azuredisk/controllerserver.go +++ b/pkg/azuredisk/controllerserver.go @@ -347,12 +347,15 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) DiskEncryptionSetID: diskEncryptionSetID, MaxShares: int32(maxShares), LogicalSectorSize: int32(logicalSectorSize), - NetworkAccessPolicy: networkAccessPolicy, BurstingEnabled: enableBursting, } volumeOptions.SkipGetDiskOperation = d.isGetDiskThrottled() - if diskAccessID != "" { - volumeOptions.DiskAccessID = &diskAccessID + // Azure Stack Cloud does not support NetworkAccessPolicy + if !IsAzureStackCloud(d.cloud.Config.Cloud, d.cloud.Config.DisableAzureStackCloud) { + volumeOptions.NetworkAccessPolicy = networkAccessPolicy + if diskAccessID != "" { + volumeOptions.DiskAccessID = &diskAccessID + } } diskURI, err := d.cloud.CreateManagedDisk(volumeOptions) if err != nil { diff --git a/pkg/azuredisk/controllerserver_v2.go b/pkg/azuredisk/controllerserver_v2.go index ed2ee40724..20412bffab 100644 --- a/pkg/azuredisk/controllerserver_v2.go +++ b/pkg/azuredisk/controllerserver_v2.go @@ -285,11 +285,14 @@ func (d *DriverV2) CreateVolume(ctx context.Context, req *csi.CreateVolumeReques DiskEncryptionSetID: diskEncryptionSetID, MaxShares: int32(maxShares), LogicalSectorSize: int32(logicalSectorSize), - NetworkAccessPolicy: networkAccessPolicy, BurstingEnabled: enableBursting, } - if diskAccessID != "" { - volumeOptions.DiskAccessID = &diskAccessID + // Azure Stack Cloud does not support NetworkAccessPolicy + if !IsAzureStackCloud(d.cloud.Config.Cloud, d.cloud.Config.DisableAzureStackCloud) { + volumeOptions.NetworkAccessPolicy = networkAccessPolicy + if diskAccessID != "" { + volumeOptions.DiskAccessID = &diskAccessID + } } diskURI, err := d.cloud.CreateManagedDisk(volumeOptions) if err != nil {