Code review comment: Should we make matching case-insensitive?  ```java Pattern pattern = Pattern.compile("/subscriptions/([\\w-]+)/", Pattern.CASE_INSENSITIVE); ```

Code under review:
public Response intercept(Chain chain) throws IOException {
        Response response = chain.proceed(chain.request());
        if (!response.isSuccessful()) {
            String content = errorBody(response.body());
            RestClient restClient = new RestClient.Builder()
                    .withBaseUrl("https:
                    .withCredentials(credentials)
                    .withSerializerAdapter(new AzureJacksonAdapter())
                    .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
                    .build();
            CloudError cloudError = restClient.serializerAdapter().deserialize(content, CloudError.class);
            if ("MissingSubscriptionRegistration".equals(cloudError.code())) {
                Pattern pattern = Pattern.compile("/subscriptions/([\\w-]+)/");
                Matcher matcher = pattern.matcher(chain.request().url().toString());
                matcher.find();
                ResourceManager resourceManager = ResourceManager.authenticate(restClient)
                        .withSubscription(matcher.group(1));
                pattern = Pattern.compile(".*'(.*)'");
                matcher = pattern.matcher(cloudError.message());
                matcher.find();
                Provider provider = registerProvider(matcher.group(1), resourceManager);
                while (provider.registrationState().equals("Unregistered")
                        || provider.registrationState().equalsIgnoreCase("Registering")) {
                    SdkContext.sleep(5 * 1000);
                    provider = resourceManager.providers().getByName(provider.namespace());
                }
                
                response = chain.proceed(chain.request());
            }
        }
        return response;
    }

Line commented on: Pattern pattern = Pattern.compile("/subscriptions/([\\w-]+)/");

Revised code:
public Response intercept(Chain chain) throws IOException {
        Response response = chain.proceed(chain.request());
        if (!response.isSuccessful()) {
            String content = errorBody(response.body());
            AzureJacksonAdapter jacksonAdapter = new AzureJacksonAdapter();
            CloudError cloudError = jacksonAdapter.deserialize(content, CloudError.class);
            if ("MissingSubscriptionRegistration".equals(cloudError.code())) {
                Pattern pattern = Pattern.compile("/subscriptions/([\\w-]+)/", Pattern.CASE_INSENSITIVE);
                Matcher matcher = pattern.matcher(chain.request().url().toString());
                matcher.find();
                RestClient restClient = new RestClient.Builder()
                        .withBaseUrl("https:
                        .withCredentials(credentials)
                        .withSerializerAdapter(jacksonAdapter)
                        .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
                        .build();
                ResourceManager resourceManager = ResourceManager.authenticate(restClient)
                        .withSubscription(matcher.group(1));
                pattern = Pattern.compile(".*'(.*)'");
                matcher = pattern.matcher(cloudError.message());
                matcher.find();
                Provider provider = registerProvider(matcher.group(1), resourceManager);
                while (provider.registrationState().equalsIgnoreCase("Unregistered")
                        || provider.registrationState().equalsIgnoreCase("Registering")) {
                    SdkContext.sleep(5 * 1000);
                    provider = resourceManager.providers().getByName(provider.namespace());
                }
                
                response = chain.proceed(chain.request());
            }
        }
        return response;
    }