diff --git a/sdk/resourcemanager/azure-resourcemanager/pom.xml b/sdk/resourcemanager/azure-resourcemanager/pom.xml
index 8f3f545b41d8..974d79a67cf4 100644
--- a/sdk/resourcemanager/azure-resourcemanager/pom.xml
+++ b/sdk/resourcemanager/azure-resourcemanager/pom.xml
@@ -184,6 +184,12 @@
1.6.3
test
+
+ com.azure
+ azure-core-http-okhttp
+ 1.3.3
+ test
+
com.jcraft
jsch
diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/MigrationGuideSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/MigrationGuideSamples.java
new file mode 100644
index 000000000000..01addde3eac1
--- /dev/null
+++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/MigrationGuideSamples.java
@@ -0,0 +1,168 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.resourcemanager;
+
+import com.azure.core.credential.TokenCredential;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.HttpPipelineCallContext;
+import com.azure.core.http.HttpPipelineNextPolicy;
+import com.azure.core.http.HttpResponse;
+import com.azure.core.http.ProxyOptions;
+import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder;
+import com.azure.core.http.policy.HttpPipelinePolicy;
+import com.azure.core.management.AzureEnvironment;
+import com.azure.core.management.Region;
+import com.azure.core.management.exception.ManagementException;
+import com.azure.core.management.profile.AzureProfile;
+import com.azure.identity.ClientSecretCredentialBuilder;
+import com.azure.resourcemanager.network.models.TransportProtocol;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS
+ * ARE USED TO EXTRACT APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING
+ * LINE NUMBERS OF EXISTING CODE SAMPLES.
+ *
+ * Code samples for the MIGRATION_GUIDE.md
+ */
+public class MigrationGuideSamples {
+ // extra empty lines to compensate import lines
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // THIS LINE MUST BE AT LINE NO. 70
+ public void authetication() {
+ TokenCredential credential = new ClientSecretCredentialBuilder()
+ .clientId("")
+ .clientSecret("")
+ .tenantId("")
+ .build();
+ AzureProfile profile = new AzureProfile("", "", AzureEnvironment.AZURE);
+ }
+
+ public void customizedPolicy(TokenCredential credential, AzureProfile profile) {
+ AzureResourceManager azure = AzureResourceManager.configure()
+ .withPolicy(new CustomizedPolicy())
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+ }
+
+ public static class CustomizedPolicy implements HttpPipelinePolicy {
+ @Override
+ public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) {
+ return next.process();
+ }
+ }
+
+ public void customizedHttpClient(TokenCredential credential, AzureProfile profile) {
+ HttpClient client = new OkHttpAsyncHttpClientBuilder()
+ .proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("127.0.0.1", 8888)))
+ .build();
+
+ AzureResourceManager azure = AzureResourceManager.configure()
+ .withHttpClient(client)
+ .authenticate(credential, profile)
+ .withDefaultSubscription();
+ }
+
+ public void errorHandling(AzureResourceManager azure) {
+ final String resourceGroupName = "invalid resource group name";
+ try {
+ azure.resourceGroups().define(resourceGroupName)
+ .withRegion(Region.US_WEST2)
+ .create();
+ } catch (ManagementException e) {
+ System.err.printf("Response code: %s%n", e.getValue().getCode());
+ System.err.printf("Response message: %s%n", e.getValue().getMessage());
+ }
+ }
+
+ public void asynchronizeCreation(AzureResourceManager azure) {
+ String rgName = "";
+ Region region = Region.US_EAST;
+ String vnetName = "";
+ String publicIpName = "";
+ String loadBalancerName1 = "";
+ String httpLoadBalancingRule = "";
+ String frontendName = "";
+ String backendPoolName1 = "";
+ String httpProbe = "";
+ String httpsLoadBalancingRule = "";
+ String backendPoolName2 = "";
+ String httpsProbe = "";
+ String natPool50XXto22 = "";
+ String natPool60XXto23 = "";
+
+ final List