Я использую Azure Java SDK версии 1.15.1.Поскольку мне нужно подключиться к Azure с использованием нестандартного Java TrustStore, я создал свой собственный файл хранилища доверенных сертификатов, который загружаю в TrustManager, а затем создал OkHttpClient.Builder, например:
OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder().sslSocketFactory(sslSocketFactory, trustManager);
Затем я создаю Retrofit Builder и использую все это для создания объекта подключения Azure:
retrofit2.Retrofit.Builder retrofitBuilder = new retrofit2.Retrofit.Builder();
retrofitBuilder.baseUrl("https://management.azure.com");
com.microsoft.rest.RestClient restClient = new RestClient.Builder(httpClientBuilder, retrofitBuilder)
.withCredentials(credentials)
.withBaseUrl("https://management.azure.com")
.withResponseBuilderFactory(new ServiceResponseBuilder.Factory())
.withSerializerAdapter(new JacksonAdapter())
.build();
Azure azureConnection = Azure.authenticate(restClient, tenantId).withSubscription(subscription);
Это прекрасно работает для извлечения всех видов данных из Azure (сети, группы безопасности и т. Д.).
Но если я хочу использовать это соединение для создания новой группы безопасности:
newSecGroup = azureConnection.getAzureConnection().networkSecurityGroups()
.define(groupName)
.withRegion(regionName)
.withExistingResourceGroup(resourceGroupName)
.withTag("MyCustomTag", groupName)
.create();
, оно выдает следующее исключение, которое на самом деле не помогает мне отследить основную причину -Может быть, кто-то может указать мне в правильном направлении?Спасибо Курт
Error when trying to create a new Security Group within resource groupksembatest, region eastus with name Cloud__Web Server for policy Web Server: com.microsoft.azure.CloudException
at com.microsoft.azure.AzureClient.createExceptionFromResponse(AzureClient.java:740)
at com.microsoft.azure.AzureClient.access$100(AzureClient.java:33)
at com.microsoft.azure.AzureClient$3.call(AzureClient.java:160)
at com.microsoft.azure.AzureClient$3.call(AzureClient.java:157)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
at retrofit2.adapter.rxjava.CallArbiter.deliverResponse(CallArbiter.java:120)
at retrofit2.adapter.rxjava.CallArbiter.emitResponse(CallArbiter.java:102)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:46)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeSingle.call(OnSubscribeSingle.java:81)
at rx.internal.operators.OnSubscribeSingle.call(OnSubscribeSingle.java:27)
at rx.internal.operators.SingleToObservable.call(SingleToObservable.java:39)
at rx.internal.operators.SingleToObservable.call(SingleToObservable.java:27)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.DeferredScalarSubscriber.subscribeTo(DeferredScalarSubscriber.java:153)
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:32)
at rx.internal.operators.OnSubscribeTakeLastOne.call(OnSubscribeTakeLastOne.java:22)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
at rx.Observable.unsafeSubscribe(Observable.java:10327)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: retrofit2.Response.class
at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:118)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:73)
... 45 more