diff --git a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/ApiCenterManagerTests.java b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/ApiCenterManagerTests.java
index faa8b1fa334a..e866b6d0eb80 100644
--- a/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/ApiCenterManagerTests.java
+++ b/sdk/apicenter/azure-resourcemanager-apicenter/src/test/java/com/azure/resourcemanager/apicenter/ApiCenterManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.apicenter.models.Service;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- apiCenterManager = ApiCenterManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ apiCenterManager = ApiCenterManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/apimanagement/azure-resourcemanager-apimanagement/src/test/java/com/azure/resourcemanager/apimanagement/ApiManagementManagerTest.java b/sdk/apimanagement/azure-resourcemanager-apimanagement/src/test/java/com/azure/resourcemanager/apimanagement/ApiManagementManagerTest.java
index 727e720c918d..e67d0d740105 100644
--- a/sdk/apimanagement/azure-resourcemanager-apimanagement/src/test/java/com/azure/resourcemanager/apimanagement/ApiManagementManagerTest.java
+++ b/sdk/apimanagement/azure-resourcemanager-apimanagement/src/test/java/com/azure/resourcemanager/apimanagement/ApiManagementManagerTest.java
@@ -20,6 +20,7 @@
import com.azure.resourcemanager.apimanagement.models.ApimIdentityType;
import com.azure.resourcemanager.apimanagement.models.SkuType;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -38,15 +39,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- apiManagementManager = ApiManagementManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ apiManagementManager = ApiManagementManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/test/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManagerTests.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/test/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManagerTests.java
index d1f9810b8e9c..fc1d3ac70b76 100644
--- a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/test/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManagerTests.java
+++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/test/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManagerTests.java
@@ -20,6 +20,7 @@
import com.azure.resourcemanager.loganalytics.LogAnalyticsManager;
import com.azure.resourcemanager.loganalytics.models.Workspace;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -39,19 +40,21 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
applicationInsightsManager = ApplicationInsightsManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
logAnalyticsManager = LogAnalyticsManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
- resourceManager = ResourceManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile)
- .withDefaultSubscription();
-
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/avs/azure-resourcemanager-avs/src/test/java/com/azure/resourcemanager/avs/AvsManagerTests.java b/sdk/avs/azure-resourcemanager-avs/src/test/java/com/azure/resourcemanager/avs/AvsManagerTests.java
index 9d672f0b74d5..0ee52d7ca4af 100644
--- a/sdk/avs/azure-resourcemanager-avs/src/test/java/com/azure/resourcemanager/avs/AvsManagerTests.java
+++ b/sdk/avs/azure-resourcemanager-avs/src/test/java/com/azure/resourcemanager/avs/AvsManagerTests.java
@@ -20,6 +20,7 @@
import com.azure.resourcemanager.avs.models.ResourceIdentityType;
import com.azure.resourcemanager.avs.models.Sku;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@@ -39,15 +40,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- avsManager = AvsManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ avsManager = AvsManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/batch/azure-resourcemanager-batch/src/test/java/com/azure/resourcemanager/batch/BatchTests.java b/sdk/batch/azure-resourcemanager-batch/src/test/java/com/azure/resourcemanager/batch/BatchTests.java
index 01f0d912c59d..c93f9d934ad8 100644
--- a/sdk/batch/azure-resourcemanager-batch/src/test/java/com/azure/resourcemanager/batch/BatchTests.java
+++ b/sdk/batch/azure-resourcemanager-batch/src/test/java/com/azure/resourcemanager/batch/BatchTests.java
@@ -3,6 +3,7 @@
package com.azure.resourcemanager.batch;
+import com.azure.core.credential.TokenCredential;
import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.management.AzureEnvironment;
@@ -27,6 +28,8 @@
import com.azure.resourcemanager.batch.models.Pool;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
+import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.storage.StorageManager;
import com.azure.resourcemanager.storage.models.StorageAccount;
import org.junit.jupiter.api.Assertions;
@@ -45,33 +48,44 @@ public class BatchTests extends TestProxyTestBase {
private static final Region REGION = Region.US_WEST2;
private String resourceGroup = "rg" + randomPadding();
+ private ResourceManager resourceManager;
private BatchManager batchManager;
private StorageManager storageManager;
private boolean testEnv;
@Override
public void beforeTest() {
+ TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
+ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
batchManager = BatchManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
storageManager = StorageManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
if (testEnv) {
resourceGroup = testResourceGroup;
} else {
- storageManager.resourceManager().resourceGroups().define(resourceGroup).withRegion(REGION).create();
+ resourceManager.resourceGroups().define(resourceGroup).withRegion(REGION).create();
}
}
@Override
protected void afterTest() {
if (!testEnv) {
- storageManager.resourceManager().resourceGroups().beginDeleteByName(resourceGroup);
+ resourceManager.resourceGroups().beginDeleteByName(resourceGroup);
}
}
@@ -188,7 +202,7 @@ public void testCRUDBatchApplication() {
.withExistingResourceGroup(resourceGroup)
.create();
// batch account
- batchAccountName = "sa" + randomPadding();
+ batchAccountName = "ba" + randomPadding();
account = batchManager.batchAccounts()
.define(batchAccountName)
.withRegion(REGION)
@@ -197,7 +211,7 @@ public void testCRUDBatchApplication() {
.create();
// create application with batch account
- applicationName = "ba" + randomPadding();
+ applicationName = "baa" + randomPadding();
String displayName = "badn" + randomPadding();
application = batchManager.applications()
.define(applicationName)
diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/test/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManagerTest.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/test/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManagerTest.java
index 54f52fd6015a..6085399a883d 100644
--- a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/test/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManagerTest.java
+++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/test/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManagerTest.java
@@ -15,6 +15,7 @@
import com.azure.core.util.CoreUtils;
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- azureChangeAnalysisManager = AzureChangeAnalysisManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ azureChangeAnalysisManager = AzureChangeAnalysisManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/ChaosManagerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/ChaosManagerTests.java
index fcd22c7a7b19..7e7a6ea1bdb8 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/ChaosManagerTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/ChaosManagerTests.java
@@ -19,6 +19,7 @@
import com.azure.resourcemanager.keyvault.KeyVaultManager;
import com.azure.resourcemanager.keyvault.models.SkuName;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -40,19 +41,21 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
chaosManager = ChaosManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
.authenticate(credential, profile);
keyVaultManager = KeyVaultManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
- resourceManager = ResourceManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile)
- .withDefaultSubscription();
-
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/test/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManagerTests.java b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/test/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManagerTests.java
index c43a1e4e5168..70bd4fbef758 100644
--- a/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/test/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManagerTests.java
+++ b/sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/test/java/com/azure/resourcemanager/cognitiveservices/CognitiveServicesManagerTests.java
@@ -17,6 +17,7 @@
import com.azure.resourcemanager.cognitiveservices.models.Account;
import com.azure.resourcemanager.cognitiveservices.models.Sku;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- cognitiveServicesManager = CognitiveServicesManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ cognitiveServicesManager = CognitiveServicesManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/computefleet/azure-resourcemanager-computefleet/src/test/java/com/azure/resourcemanager/computefleet/ComputeFleetManagerTests.java b/sdk/computefleet/azure-resourcemanager-computefleet/src/test/java/com/azure/resourcemanager/computefleet/ComputeFleetManagerTests.java
index a14a2b427aa1..ed9f209aee3a 100644
--- a/sdk/computefleet/azure-resourcemanager-computefleet/src/test/java/com/azure/resourcemanager/computefleet/ComputeFleetManagerTests.java
+++ b/sdk/computefleet/azure-resourcemanager-computefleet/src/test/java/com/azure/resourcemanager/computefleet/ComputeFleetManagerTests.java
@@ -49,6 +49,7 @@
import com.azure.resourcemanager.network.models.LoadBalancerSkuType;
import com.azure.resourcemanager.network.models.Network;
import com.azure.resourcemanager.network.models.TransportProtocol;
+import com.azure.resourcemanager.resources.ResourceManager;
import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -61,6 +62,7 @@ public class ComputeFleetManagerTests extends TestProxyTestBase {
private static final Random RANDOM = new Random();
private static final Region REGION = Region.US_WEST2;
private String resourceGroupName = "rg" + randomPadding();
+ private ResourceManager resourceManager = null;
private ComputeFleetManager computeFleetManager = null;
private NetworkManager networkManager = null;
private boolean testEnv;
@@ -70,11 +72,18 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
networkManager = NetworkManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
computeFleetManager = ComputeFleetManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.withPolicy(new ProviderRegistrationPolicy(networkManager.resourceManager()))
.authenticate(credential, profile);
@@ -85,14 +94,14 @@ public void beforeTest() {
if (testEnv) {
resourceGroupName = testResourceGroup;
} else {
- networkManager.resourceManager().resourceGroups().define(resourceGroupName).withRegion(REGION).create();
+ resourceManager.resourceGroups().define(resourceGroupName).withRegion(REGION).create();
}
}
@Override
protected void afterTest() {
if (!testEnv) {
- networkManager.resourceManager().resourceGroups().beginDeleteByName(resourceGroupName);
+ resourceManager.resourceGroups().beginDeleteByName(resourceGroupName);
}
}
diff --git a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManagerTests.java b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManagerTests.java
index cb9b2f954340..a533e723e057 100644
--- a/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManagerTests.java
+++ b/sdk/containerservicefleet/azure-resourcemanager-containerservicefleet/src/test/java/com/azure/resourcemanager/containerservicefleet/ContainerServiceFleetManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.containerservicefleet.models.Fleet;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- containerServiceFleetManager = ContainerServiceFleetManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ containerServiceFleetManager = ContainerServiceFleetManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManagerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManagerTests.java
index f68394a3b0cd..67e4d5a5e3c0 100644
--- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManagerTests.java
+++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/CosmosDBForPostgreSqlManagerTests.java
@@ -17,6 +17,7 @@
import com.azure.resourcemanager.cosmosdbforpostgresql.models.Cluster;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.MaintenanceWindow;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- cosmosDBForPostgreSqlManager = CosmosDBForPostgreSqlManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ cosmosDBForPostgreSqlManager = CosmosDBForPostgreSqlManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/dashboard/azure-resourcemanager-dashboard/src/test/java/com/azure/resourcemanager/dashboard/DashboardManagerTests.java b/sdk/dashboard/azure-resourcemanager-dashboard/src/test/java/com/azure/resourcemanager/dashboard/DashboardManagerTests.java
index a2e3786debf2..d950c2b3406a 100644
--- a/sdk/dashboard/azure-resourcemanager-dashboard/src/test/java/com/azure/resourcemanager/dashboard/DashboardManagerTests.java
+++ b/sdk/dashboard/azure-resourcemanager-dashboard/src/test/java/com/azure/resourcemanager/dashboard/DashboardManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.dashboard.models.*;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- dashboardManager = DashboardManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ dashboardManager = DashboardManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/DataFactoryTests.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/DataFactoryTests.java
index be9a16e19130..b9e541b805bb 100644
--- a/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/DataFactoryTests.java
+++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/test/java/com/azure/resourcemanager/datafactory/DataFactoryTests.java
@@ -3,6 +3,7 @@
package com.azure.resourcemanager.datafactory;
+import com.azure.core.credential.TokenCredential;
import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.management.AzureEnvironment;
@@ -26,6 +27,8 @@
import com.azure.resourcemanager.datafactory.models.PipelineResource;
import com.azure.resourcemanager.datafactory.models.PipelineRun;
import com.azure.resourcemanager.datafactory.models.TextFormat;
+import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.storage.StorageManager;
import com.azure.resourcemanager.storage.models.PublicAccess;
import com.azure.resourcemanager.storage.models.StorageAccount;
@@ -50,19 +53,29 @@ public class DataFactoryTests extends TestProxyTestBase {
@Test
@LiveOnly
public void dataFactoryTest() {
- StorageManager storageManager = StorageManager.authenticate(new AzurePowerShellCredentialBuilder().build(),
- new AzureProfile(AzureEnvironment.AZURE));
+ TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
+ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+
+ ResourceManager resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
+ StorageManager storageManager = StorageManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .authenticate(credential, profile);
DataFactoryManager manager = DataFactoryManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
boolean testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
if (testEnv) {
resourceGroup = testResourceGroup;
} else {
- storageManager.resourceManager().resourceGroups().define(resourceGroup).withRegion(REGION).create();
+ resourceManager.resourceGroups().define(resourceGroup).withRegion(REGION).create();
}
try {
@@ -169,7 +182,7 @@ public void dataFactoryTest() {
storageManager.storageAccounts().deleteById(storageAccount.id());
} finally {
if (!testEnv) {
- storageManager.resourceManager().resourceGroups().beginDeleteByName(resourceGroup);
+ resourceManager.resourceGroups().beginDeleteByName(resourceGroup);
}
}
}
diff --git a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/test/java/com/azure/resourcemanager/dataprotection/DataProtectionManagerTest.java b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/test/java/com/azure/resourcemanager/dataprotection/DataProtectionManagerTest.java
index 7adc04bab04d..698513a0066b 100644
--- a/sdk/dataprotection/azure-resourcemanager-dataprotection/src/test/java/com/azure/resourcemanager/dataprotection/DataProtectionManagerTest.java
+++ b/sdk/dataprotection/azure-resourcemanager-dataprotection/src/test/java/com/azure/resourcemanager/dataprotection/DataProtectionManagerTest.java
@@ -39,6 +39,7 @@
import com.azure.resourcemanager.dataprotection.models.StorageSettingStoreTypes;
import com.azure.resourcemanager.dataprotection.models.StorageSettingTypes;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -58,15 +59,16 @@ public void beforeTest() {
final TokenCredential credential = getIdentityTestCredential(super.interceptorManager);
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- dataProtectionManager = DataProtectionManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ dataProtectionManager = DataProtectionManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/deviceupdate/azure-resourcemanager-deviceupdate/src/test/java/com/azure/resourcemanager/deviceupdate/DeviceUpdateManagerTests.java b/sdk/deviceupdate/azure-resourcemanager-deviceupdate/src/test/java/com/azure/resourcemanager/deviceupdate/DeviceUpdateManagerTests.java
index d771f498a6aa..45310bf90fd3 100644
--- a/sdk/deviceupdate/azure-resourcemanager-deviceupdate/src/test/java/com/azure/resourcemanager/deviceupdate/DeviceUpdateManagerTests.java
+++ b/sdk/deviceupdate/azure-resourcemanager-deviceupdate/src/test/java/com/azure/resourcemanager/deviceupdate/DeviceUpdateManagerTests.java
@@ -17,6 +17,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.deviceupdate.models.Account;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- deviceUpdateManager = DeviceUpdateManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ deviceUpdateManager = DeviceUpdateManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/test/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManagerTests.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/test/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManagerTests.java
index ca3ef88d2300..e6727a04dfab 100644
--- a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/test/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManagerTests.java
+++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/test/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.devtestlabs.models.Lab;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- devTestLabsManager = DevTestLabsManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ devTestLabsManager = DevTestLabsManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/test/java/com/azure/resourcemanager/fluidrelay/FluidRelayManagerTests.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/test/java/com/azure/resourcemanager/fluidrelay/FluidRelayManagerTests.java
index 78ba328ec3a0..c34a141c99ca 100644
--- a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/test/java/com/azure/resourcemanager/fluidrelay/FluidRelayManagerTests.java
+++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/test/java/com/azure/resourcemanager/fluidrelay/FluidRelayManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.fluidrelay.models.FluidRelayServer;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- fluidRelayManager = FluidRelayManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ fluidRelayManager = FluidRelayManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/frontdoor/azure-resourcemanager-frontdoor/src/test/java/com/azure/resourcemanager/frontdoor/FrontDoorManagerTests.java b/sdk/frontdoor/azure-resourcemanager-frontdoor/src/test/java/com/azure/resourcemanager/frontdoor/FrontDoorManagerTests.java
index 2a268993cf1e..ec3bf55422dd 100644
--- a/sdk/frontdoor/azure-resourcemanager-frontdoor/src/test/java/com/azure/resourcemanager/frontdoor/FrontDoorManagerTests.java
+++ b/sdk/frontdoor/azure-resourcemanager-frontdoor/src/test/java/com/azure/resourcemanager/frontdoor/FrontDoorManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.frontdoor.models.WebApplicationFirewallPolicy;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- frontDoorManager = FrontDoorManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ frontDoorManager = FrontDoorManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/healthcareapis/azure-resourcemanager-healthcareapis/src/test/java/com/azure/resourcemanager/healthcareapis/HealthcareApisManagerTests.java b/sdk/healthcareapis/azure-resourcemanager-healthcareapis/src/test/java/com/azure/resourcemanager/healthcareapis/HealthcareApisManagerTests.java
index 7e074dbbdea8..52a90b518e77 100644
--- a/sdk/healthcareapis/azure-resourcemanager-healthcareapis/src/test/java/com/azure/resourcemanager/healthcareapis/HealthcareApisManagerTests.java
+++ b/sdk/healthcareapis/azure-resourcemanager-healthcareapis/src/test/java/com/azure/resourcemanager/healthcareapis/HealthcareApisManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.healthcareapis.models.*;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- healthcareApisManager = HealthcareApisManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ healthcareApisManager = HealthcareApisManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/test/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManagerTests.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/test/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManagerTests.java
index 380dc052f0a2..95d82fb588fd 100644
--- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/test/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManagerTests.java
+++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/test/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManagerTests.java
@@ -25,6 +25,7 @@
import com.azure.resourcemanager.msi.MsiManager;
import com.azure.resourcemanager.msi.models.Identity;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -47,19 +48,21 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
imageBuilderManager = ImageBuilderManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
msiManager = MsiManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
- resourceManager = ResourceManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile)
- .withDefaultSubscription();
-
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/test/java/com/azure/resourcemanager/iotcentral/IotCentralManagerTests.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/test/java/com/azure/resourcemanager/iotcentral/IotCentralManagerTests.java
index 5f326702fdfe..d249730ebb17 100644
--- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/test/java/com/azure/resourcemanager/iotcentral/IotCentralManagerTests.java
+++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/test/java/com/azure/resourcemanager/iotcentral/IotCentralManagerTests.java
@@ -23,6 +23,7 @@
import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity;
import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -42,15 +43,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- iotCentralManager = IotCentralManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ iotCentralManager = IotCentralManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManagerTests.java b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManagerTests.java
index b21f21cf3494..e6c67960f5e1 100644
--- a/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManagerTests.java
+++ b/sdk/iotfirmwaredefense/azure-resourcemanager-iotfirmwaredefense/src/test/java/com/azure/resourcemanager/iotfirmwaredefense/IoTFirmwareDefenseManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.iotfirmwaredefense.models.Workspace;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- ioTFirmwareDefenseManager = IoTFirmwareDefenseManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ ioTFirmwareDefenseManager = IoTFirmwareDefenseManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/IotHubManagerTests.java b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/IotHubManagerTests.java
index bd55047f74ee..038bf020ec19 100644
--- a/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/IotHubManagerTests.java
+++ b/sdk/iothub/azure-resourcemanager-iothub/src/test/java/com/azure/resourcemanager/iothub/IotHubManagerTests.java
@@ -30,6 +30,7 @@
import com.azure.resourcemanager.iothub.models.ResourceIdentityType;
import com.azure.resourcemanager.iothub.models.StorageEndpointProperties;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import io.netty.util.internal.StringUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -54,15 +55,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- iotHubManager = IotHubManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ iotHubManager = IotHubManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/kusto/azure-resourcemanager-kusto/src/test/java/com/azure/resourcemanager/kusto/KustoManagerTests.java b/sdk/kusto/azure-resourcemanager-kusto/src/test/java/com/azure/resourcemanager/kusto/KustoManagerTests.java
index 214a7afe1697..6457afbb1bc3 100644
--- a/sdk/kusto/azure-resourcemanager-kusto/src/test/java/com/azure/resourcemanager/kusto/KustoManagerTests.java
+++ b/sdk/kusto/azure-resourcemanager-kusto/src/test/java/com/azure/resourcemanager/kusto/KustoManagerTests.java
@@ -19,6 +19,7 @@
import com.azure.resourcemanager.kusto.models.AzureSkuTier;
import com.azure.resourcemanager.kusto.models.Cluster;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -37,15 +38,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- kustoManager = KustoManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ kustoManager = KustoManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/TestOrchestratorTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/TestOrchestratorTests.java
index f91ac22f6e9d..41964dd39cc3 100644
--- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/TestOrchestratorTests.java
+++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/TestOrchestratorTests.java
@@ -17,6 +17,7 @@
import java.util.Random;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Test;
public class TestOrchestratorTests extends TestProxyTestBase {
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- loadTestManager = LoadTestManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ loadTestManager = LoadTestManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
if (testEnv) {
diff --git a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/test/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManagerTests.java b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/test/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManagerTests.java
index 45de8ad1887f..374d5b25afde 100644
--- a/sdk/loganalytics/azure-resourcemanager-loganalytics/src/test/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManagerTests.java
+++ b/sdk/loganalytics/azure-resourcemanager-loganalytics/src/test/java/com/azure/resourcemanager/loganalytics/LogAnalyticsManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.loganalytics.models.Workspace;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- logAnalyticsManager = LogAnalyticsManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ logAnalyticsManager = LogAnalyticsManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/machinelearning/azure-resourcemanager-machinelearning/src/test/java/com/azure/resourcemanager/machinelearning/MachineLearningManagerTests.java b/sdk/machinelearning/azure-resourcemanager-machinelearning/src/test/java/com/azure/resourcemanager/machinelearning/MachineLearningManagerTests.java
index f4d7e69aea6c..66afd7bc79ad 100644
--- a/sdk/machinelearning/azure-resourcemanager-machinelearning/src/test/java/com/azure/resourcemanager/machinelearning/MachineLearningManagerTests.java
+++ b/sdk/machinelearning/azure-resourcemanager-machinelearning/src/test/java/com/azure/resourcemanager/machinelearning/MachineLearningManagerTests.java
@@ -24,6 +24,7 @@
import com.azure.resourcemanager.machinelearning.models.SkuTier;
import com.azure.resourcemanager.machinelearning.models.Workspace;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.storage.StorageManager;
import com.azure.resourcemanager.storage.models.AccessTier;
import com.azure.resourcemanager.storage.models.MinimumTlsVersion;
@@ -49,27 +50,31 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
machineLearningManager = MachineLearningManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
storageManager = StorageManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
keyVaultManager = KeyVaultManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
applicationInsightsManager = ApplicationInsightsManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
- resourceManager = ResourceManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile)
- .withDefaultSubscription();
-
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/src/test/java/com/azure/resourcemanager/managednetworkfabric/ManagedNetworkFabricManagerTest.java b/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/src/test/java/com/azure/resourcemanager/managednetworkfabric/ManagedNetworkFabricManagerTest.java
index 6c6e5a35e39c..7aef196dbc23 100644
--- a/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/src/test/java/com/azure/resourcemanager/managednetworkfabric/ManagedNetworkFabricManagerTest.java
+++ b/sdk/managednetworkfabric/azure-resourcemanager-managednetworkfabric/src/test/java/com/azure/resourcemanager/managednetworkfabric/ManagedNetworkFabricManagerTest.java
@@ -33,6 +33,7 @@
import com.azure.resourcemanager.managednetworkfabric.models.VlanGroupProperties;
import com.azure.resourcemanager.managednetworkfabric.models.VlanMatchCondition;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -52,15 +53,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- managedNetworkFabricManager = ManagedNetworkFabricManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ managedNetworkFabricManager = ManagedNetworkFabricManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml b/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml
index a6db1f20f6aa..ccdca013faf7 100644
--- a/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml
+++ b/sdk/mediaservices/azure-resourcemanager-mediaservices/pom.xml
@@ -95,5 +95,11 @@
2.45.0
test
+
+ com.azure.resourcemanager
+ azure-resourcemanager-resources
+ 2.45.0
+ test
+
diff --git a/sdk/mediaservices/azure-resourcemanager-mediaservices/src/test/java/com/azure/resourcemanager/mediaservices/MediaServicesTests.java b/sdk/mediaservices/azure-resourcemanager-mediaservices/src/test/java/com/azure/resourcemanager/mediaservices/MediaServicesTests.java
index d5fcc6e670d0..0812ed383768 100644
--- a/sdk/mediaservices/azure-resourcemanager-mediaservices/src/test/java/com/azure/resourcemanager/mediaservices/MediaServicesTests.java
+++ b/sdk/mediaservices/azure-resourcemanager-mediaservices/src/test/java/com/azure/resourcemanager/mediaservices/MediaServicesTests.java
@@ -3,6 +3,7 @@
package com.azure.resourcemanager.mediaservices;
+import com.azure.core.credential.TokenCredential;
import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.management.AzureEnvironment;
@@ -24,6 +25,8 @@
import com.azure.resourcemanager.mediaservices.models.StorageAccountType;
import com.azure.resourcemanager.mediaservices.models.Transform;
import com.azure.resourcemanager.mediaservices.models.TransformOutput;
+import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.storage.StorageManager;
import com.azure.resourcemanager.storage.models.StorageAccount;
import org.junit.jupiter.api.Assertions;
@@ -47,20 +50,30 @@ public class MediaServicesTests extends TestProxyTestBase {
@Test
@LiveOnly
public void mediaServicesTest() {
+ TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
+ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+
+ ResourceManager resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
StorageManager storageManager = StorageManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
MediaServicesManager manager = MediaServicesManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
boolean testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
if (testEnv) {
resourceGroup = testResourceGroup;
} else {
- storageManager.resourceManager().resourceGroups().define(resourceGroup).withRegion(REGION).create();
+ resourceManager.resourceGroups().define(resourceGroup).withRegion(REGION).create();
}
try {
@@ -127,7 +140,7 @@ public void mediaServicesTest() {
storageManager.storageAccounts().deleteById(storageAccount.id());
} finally {
if (!testEnv) {
- storageManager.resourceManager().resourceGroups().beginDeleteByName(resourceGroup);
+ resourceManager.resourceGroups().beginDeleteByName(resourceGroup);
}
}
}
diff --git a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/MongoClusterManagerTests.java b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/MongoClusterManagerTests.java
index d5b883eaab82..c3349a5bb436 100644
--- a/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/MongoClusterManagerTests.java
+++ b/sdk/mongocluster/azure-resourcemanager-mongocluster/src/test/java/com/azure/resourcemanager/mongocluster/MongoClusterManagerTests.java
@@ -24,6 +24,7 @@
import com.azure.resourcemanager.mongocluster.models.ShardingProperties;
import com.azure.resourcemanager.mongocluster.models.StorageProperties;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -43,15 +44,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- mongoClusterManager = MongoClusterManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ mongoClusterManager = MongoClusterManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/mysql/azure-resourcemanager-mysql/src/test/java/com/azure/resourcemanager/mysql/MySqlManagerTests.java b/sdk/mysql/azure-resourcemanager-mysql/src/test/java/com/azure/resourcemanager/mysql/MySqlManagerTests.java
index aa4fb5ac890f..0cb313b8a8e7 100644
--- a/sdk/mysql/azure-resourcemanager-mysql/src/test/java/com/azure/resourcemanager/mysql/MySqlManagerTests.java
+++ b/sdk/mysql/azure-resourcemanager-mysql/src/test/java/com/azure/resourcemanager/mysql/MySqlManagerTests.java
@@ -29,11 +29,13 @@
import com.azure.resourcemanager.resources.ResourceManager;
import io.netty.util.internal.StringUtil;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.Random;
import java.util.UUID;
+@Disabled("Azure Database for MySQL - Single Server retired on September 16, 2024.")
public class MySqlManagerTests extends TestProxyTestBase {
private static final Random RANDOM = new Random();
private static final Region REGION = Region.EUROPE_WEST;
diff --git a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/test/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManagerTest.java b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/test/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManagerTest.java
index abc833ccf635..801e24e8bd14 100644
--- a/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/test/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManagerTest.java
+++ b/sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/test/java/com/azure/resourcemanager/mysqlflexibleserver/MySqlManagerTest.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.mysqlflexibleserver.models.Server;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import io.netty.util.internal.StringUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -36,15 +37,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- mysqlManager = MySqlManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ mysqlManager = MySqlManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/src/test/java/com/azure/resourcemanager/paloaltonetworks/ngfw/PaloAltoNetworksNgfwManagerTests.java b/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/src/test/java/com/azure/resourcemanager/paloaltonetworks/ngfw/PaloAltoNetworksNgfwManagerTests.java
index 35df74a5c2a0..078d5b555558 100644
--- a/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/src/test/java/com/azure/resourcemanager/paloaltonetworks/ngfw/PaloAltoNetworksNgfwManagerTests.java
+++ b/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/src/test/java/com/azure/resourcemanager/paloaltonetworks/ngfw/PaloAltoNetworksNgfwManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.*;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- paloAltoNetworksNgfwManager = PaloAltoNetworksNgfwManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ paloAltoNetworksNgfwManager = PaloAltoNetworksNgfwManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/PostgreSqlManagerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/PostgreSqlManagerTests.java
index 9d553ae8944a..a71c03538cfa 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/PostgreSqlManagerTests.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/PostgreSqlManagerTests.java
@@ -16,6 +16,7 @@
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.postgresql.models.*;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import io.netty.util.internal.StringUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -36,15 +37,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- postgreSqlManager = PostgreSqlManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ postgreSqlManager = PostgreSqlManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManagerTests.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManagerTests.java
index d4d24324b23f..2c044e491554 100644
--- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManagerTests.java
+++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/test/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManagerTests.java
@@ -32,6 +32,7 @@
import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage;
import com.azure.resourcemanager.postgresqlflexibleserver.models.UserAssignedIdentity;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import io.netty.util.internal.StringUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -41,7 +42,7 @@
public class PostgreSqlManagerTests extends TestProxyTestBase {
private static final Random RANDOM = new Random();
- private static final Region REGION = Region.US_WEST;
+ private static final Region REGION = Region.US_WEST3;
private String resourceGroupName = "rg" + randomPadding();
private PostgreSqlManager postgreSqlManager;
private ResourceManager resourceManager;
@@ -52,15 +53,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- postgreSqlManager = PostgreSqlManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ postgreSqlManager = PostgreSqlManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/providerhub/azure-resourcemanager-providerhub/src/test/java/com/azure/resourcemanager/providerhub/ProviderHubManagerTests.java b/sdk/providerhub/azure-resourcemanager-providerhub/src/test/java/com/azure/resourcemanager/providerhub/ProviderHubManagerTests.java
index 60c1c307715b..98276136aabb 100644
--- a/sdk/providerhub/azure-resourcemanager-providerhub/src/test/java/com/azure/resourcemanager/providerhub/ProviderHubManagerTests.java
+++ b/sdk/providerhub/azure-resourcemanager-providerhub/src/test/java/com/azure/resourcemanager/providerhub/ProviderHubManagerTests.java
@@ -19,6 +19,7 @@
import com.azure.resourcemanager.providerhub.models.OperationsDefinitionDisplay;
import com.azure.resourcemanager.providerhub.models.OperationsPutContent;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -38,15 +39,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- providerHubManager = ProviderHubManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ providerHubManager = ProviderHubManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/test/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManagerTests.java b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/test/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManagerTests.java
index b262eeefd962..02dbb47bfb2e 100644
--- a/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/test/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManagerTests.java
+++ b/sdk/recoveryservices/azure-resourcemanager-recoveryservices/src/test/java/com/azure/resourcemanager/recoveryservices/RecoveryServicesManagerTests.java
@@ -26,6 +26,7 @@
import com.azure.resourcemanager.recoveryservices.models.Vault;
import com.azure.resourcemanager.recoveryservices.models.VaultProperties;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -44,15 +45,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- recoveryServicesManager = RecoveryServicesManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ recoveryServicesManager = RecoveryServicesManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManagerTests.java b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManagerTests.java
index 3cf1124dacac..c8b41d4d7972 100644
--- a/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManagerTests.java
+++ b/sdk/recoveryservicesbackup/azure-resourcemanager-recoveryservicesbackup/src/test/java/com/azure/resourcemanager/recoveryservicesbackup/RecoveryServicesBackupManagerTests.java
@@ -45,6 +45,7 @@
import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType;
import com.azure.resourcemanager.recoveryservicesbackup.models.YearlyRetentionSchedule;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -69,19 +70,21 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+ resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
recoveryServicesManager = RecoveryServicesManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
recoveryServicesBackupManager = RecoveryServicesBackupManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile);
- resourceManager = ResourceManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile)
- .withDefaultSubscription();
-
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/ResourceHealthTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/ResourceHealthTests.java
index 6fbe0c18c2c6..e0265bf01c1a 100644
--- a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/ResourceHealthTests.java
+++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/ResourceHealthTests.java
@@ -3,6 +3,7 @@
package com.azure.resourcemanager.resourcehealth;
+import com.azure.core.credential.TokenCredential;
import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.rest.PagedIterable;
@@ -21,6 +22,8 @@
import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes;
import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues;
import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus;
+import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -41,20 +44,30 @@ private static String randomPadding() {
@Test
@LiveOnly
public void resourceHealthTest() {
+ TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
+ AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
+
+ ResourceManager resourceManager = ResourceManager.configure()
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+
ComputeManager computeManager = ComputeManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
ResourceHealthManager resourceHealthManager = ResourceHealthManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))
- .authenticate(new AzurePowerShellCredentialBuilder().build(), new AzureProfile(AzureEnvironment.AZURE));
+ .authenticate(credential, profile);
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
boolean testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
if (testEnv) {
resourceGroup = testResourceGroup;
} else {
- computeManager.resourceManager().resourceGroups().define(resourceGroup).withRegion(REGION).create();
+ resourceManager.resourceGroups().define(resourceGroup).withRegion(REGION).create();
}
try {
@@ -115,7 +128,7 @@ public void resourceHealthTest() {
// && AvailabilityStateValues.AVAILABLE.equals(status.properties().availabilityState())));
} finally {
if (!testEnv) {
- computeManager.resourceManager().resourceGroups().beginDeleteByName(resourceGroup);
+ resourceManager.resourceGroups().beginDeleteByName(resourceGroup);
}
}
}
diff --git a/sdk/resourcemover/azure-resourcemanager-resourcemover/src/test/java/com/azure/resourcemanager/resourcemover/ResourceMoverManagerTests.java b/sdk/resourcemover/azure-resourcemanager-resourcemover/src/test/java/com/azure/resourcemanager/resourcemover/ResourceMoverManagerTests.java
index abbb90fd50be..f90e730ace8b 100644
--- a/sdk/resourcemover/azure-resourcemanager-resourcemover/src/test/java/com/azure/resourcemanager/resourcemover/ResourceMoverManagerTests.java
+++ b/sdk/resourcemover/azure-resourcemanager-resourcemover/src/test/java/com/azure/resourcemanager/resourcemover/ResourceMoverManagerTests.java
@@ -17,6 +17,7 @@
import com.azure.resourcemanager.resourcemover.models.MoveCollection;
import com.azure.resourcemanager.resourcemover.models.MoveCollectionProperties;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- resourceMoverManager = ResourceMoverManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ resourceMoverManager = ResourceMoverManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/servicefabricmanagedclusters/azure-resourcemanager-servicefabricmanagedclusters/src/test/java/com/azure/resourcemanager/servicefabricmanagedclusters/ServiceFabricManagedClustersManagerTests.java b/sdk/servicefabricmanagedclusters/azure-resourcemanager-servicefabricmanagedclusters/src/test/java/com/azure/resourcemanager/servicefabricmanagedclusters/ServiceFabricManagedClustersManagerTests.java
index cb6bd4dc5ebe..e662038f5491 100644
--- a/sdk/servicefabricmanagedclusters/azure-resourcemanager-servicefabricmanagedclusters/src/test/java/com/azure/resourcemanager/servicefabricmanagedclusters/ServiceFabricManagedClustersManagerTests.java
+++ b/sdk/servicefabricmanagedclusters/azure-resourcemanager-servicefabricmanagedclusters/src/test/java/com/azure/resourcemanager/servicefabricmanagedclusters/ServiceFabricManagedClustersManagerTests.java
@@ -15,17 +15,13 @@
import com.azure.core.util.CoreUtils;
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.resources.ResourceManager;
-import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;
-import com.azure.resourcemanager.resources.models.Provider;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.servicefabricmanagedclusters.models.ManagedCluster;
import com.azure.resourcemanager.servicefabricmanagedclusters.models.Sku;
import com.azure.resourcemanager.servicefabricmanagedclusters.models.SkuName;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import java.time.Duration;
-import java.util.Arrays;
-import java.util.List;
import java.util.Random;
import java.util.UUID;
@@ -42,16 +38,15 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- serviceFabricManagedClustersManager = ServiceFabricManagedClustersManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
- canRegisterProviders(Arrays.asList("Microsoft.ServiceFabric"));
+ serviceFabricManagedClustersManager = ServiceFabricManagedClustersManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
@@ -110,23 +105,4 @@ public void testCreateManagedCluster() {
private static String randomPadding() {
return String.format("%05d", Math.abs(RANDOM.nextInt() % 100000));
}
-
- /**
- * Check and register service resources
- *
- * @param providerNamespaces the resource provider names
- */
- private void canRegisterProviders(List providerNamespaces) {
- providerNamespaces.forEach(providerNamespace -> {
- Provider provider = resourceManager.providers().getByName(providerNamespace);
- if (!"Registered".equalsIgnoreCase(provider.registrationState())
- && !"Registering".equalsIgnoreCase(provider.registrationState())) {
- provider = resourceManager.providers().register(providerNamespace);
- }
- while (!"Registered".equalsIgnoreCase(provider.registrationState())) {
- ResourceManagerUtils.sleep(Duration.ofSeconds(5));
- provider = resourceManager.providers().getByName(provider.namespace());
- }
- });
- }
}
diff --git a/sdk/servicenetworking/azure-resourcemanager-servicenetworking/src/test/java/com/azure/resourcemanager/servicenetworking/TrafficControllerManagerTests.java b/sdk/servicenetworking/azure-resourcemanager-servicenetworking/src/test/java/com/azure/resourcemanager/servicenetworking/TrafficControllerManagerTests.java
index 5214c6be6228..68b15e8267fa 100644
--- a/sdk/servicenetworking/azure-resourcemanager-servicenetworking/src/test/java/com/azure/resourcemanager/servicenetworking/TrafficControllerManagerTests.java
+++ b/sdk/servicenetworking/azure-resourcemanager-servicenetworking/src/test/java/com/azure/resourcemanager/servicenetworking/TrafficControllerManagerTests.java
@@ -15,6 +15,7 @@
import com.azure.core.util.CoreUtils;
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.servicenetworking.models.TrafficController;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- trafficControllerManager = TrafficControllerManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ trafficControllerManager = TrafficControllerManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/AzureSphereManagerTests.java b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/AzureSphereManagerTests.java
index ad1deba3c3b5..a18645c49e9c 100644
--- a/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/AzureSphereManagerTests.java
+++ b/sdk/sphere/azure-resourcemanager-sphere/src/test/java/com/azure/resourcemanager/sphere/AzureSphereManagerTests.java
@@ -15,6 +15,7 @@
import com.azure.core.util.CoreUtils;
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.sphere.models.Catalog;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -35,15 +36,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- azureSphereManager = AzureSphereManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ azureSphereManager = AzureSphereManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/test/java/com/azure/resourcemanager/storagemover/StorageMoverManagerTests.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/test/java/com/azure/resourcemanager/storagemover/StorageMoverManagerTests.java
index 08e641677dcd..8211480ee8e3 100644
--- a/sdk/storagemover/azure-resourcemanager-storagemover/src/test/java/com/azure/resourcemanager/storagemover/StorageMoverManagerTests.java
+++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/test/java/com/azure/resourcemanager/storagemover/StorageMoverManagerTests.java
@@ -15,6 +15,7 @@
import com.azure.core.util.CoreUtils;
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.storagemover.models.StorageMover;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -23,7 +24,7 @@
public class StorageMoverManagerTests extends TestProxyTestBase {
private static final Random RANDOM = new Random();
- private static final Region REGION = Region.create("eastus2euap", "East US 2 EUAP");
+ private static final Region REGION = Region.US_EAST2;
private String resourceGroupName = "rg" + randomPadding();
private StorageMoverManager storageMoverManager;
private ResourceManager resourceManager;
@@ -34,15 +35,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- storageMoverManager = StorageMoverManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ storageMoverManager = StorageMoverManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
diff --git a/sdk/webpubsub/azure-resourcemanager-webpubsub/src/test/java/com/azure/resourcemanager/webpubsub/WebPubSubManagerTests.java b/sdk/webpubsub/azure-resourcemanager-webpubsub/src/test/java/com/azure/resourcemanager/webpubsub/WebPubSubManagerTests.java
index cade90cba06d..d0305fa4c0f1 100644
--- a/sdk/webpubsub/azure-resourcemanager-webpubsub/src/test/java/com/azure/resourcemanager/webpubsub/WebPubSubManagerTests.java
+++ b/sdk/webpubsub/azure-resourcemanager-webpubsub/src/test/java/com/azure/resourcemanager/webpubsub/WebPubSubManagerTests.java
@@ -15,6 +15,7 @@
import com.azure.core.util.CoreUtils;
import com.azure.identity.AzurePowerShellCredentialBuilder;
import com.azure.resourcemanager.resources.ResourceManager;
+import com.azure.resourcemanager.resources.fluentcore.policy.ProviderRegistrationPolicy;
import com.azure.resourcemanager.webpubsub.models.ResourceSku;
import com.azure.resourcemanager.webpubsub.models.WebPubSubResource;
import com.azure.resourcemanager.webpubsub.models.WebPubSubSkuTier;
@@ -37,15 +38,16 @@ public void beforeTest() {
final TokenCredential credential = new AzurePowerShellCredentialBuilder().build();
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
- webPubSubManager = WebPubSubManager.configure()
- .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
- .authenticate(credential, profile);
-
resourceManager = ResourceManager.configure()
.withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
.authenticate(credential, profile)
.withDefaultSubscription();
+ webPubSubManager = WebPubSubManager.configure()
+ .withPolicy(new ProviderRegistrationPolicy(resourceManager))
+ .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC))
+ .authenticate(credential, profile);
+
// use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI
String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);