@@ -203,7 +203,7 @@ public override ServerRegistrationData Setup(Uri managementEndpointUri, Guid sub
203
203
var serverRegistrationData = new ServerRegistrationData
204
204
{
205
205
Id = resourceId ,
206
- ServerId = Guid . Empty ,
206
+ ServerId = serverGuid ,
207
207
ServerCertificate = syncServerCertificate . ToBase64Bytes ( true ) ,
208
208
ServerRole = isInCluster ? ServerRoleType . ClusterNode : ServerRoleType . Standalone ,
209
209
ServerOSVersion = osVersion ,
@@ -250,15 +250,14 @@ public override ServerRegistrationData Setup(Uri managementEndpointUri, Guid sub
250
250
/// </exception>
251
251
public override bool Persist ( RegisteredServer registeredServerResource , Guid subscriptionId , string storageSyncServiceName , string resourceGroupName , string monitoringDataPath )
252
252
{
253
- Guid storageSyncServiceUid = Guid . Empty ;
253
+ var storageSyncServiceUid = Guid . Empty ;
254
254
bool hasStorageSyncServiceUid = Guid . TryParse ( registeredServerResource . StorageSyncServiceUid , out storageSyncServiceUid ) ;
255
255
if ( ! hasStorageSyncServiceUid )
256
256
{
257
257
throw new ArgumentException ( nameof ( registeredServerResource . StorageSyncServiceUid ) ) ;
258
258
}
259
259
260
- ServerRoleType serverRole ;
261
- bool hasServerRole = Enum . TryParse ( registeredServerResource . ServerRole , out serverRole ) ;
260
+ bool hasServerRole = Enum . TryParse ( registeredServerResource . ServerRole , out ServerRoleType serverRole ) ;
262
261
if ( ! hasServerRole )
263
262
{
264
263
throw new ArgumentException ( nameof ( registeredServerResource . ServerRole ) ) ;
@@ -292,7 +291,12 @@ public override bool Persist(RegisteredServer registeredServerResource, Guid sub
292
291
throw new ServerRegistrationException ( ServerRegistrationErrorCode . PersistSyncServerRegistrationFailed , hr , ErrorCategory . InvalidResult ) ;
293
292
}
294
293
295
- var monitoringConfiguration = JsonConvert . DeserializeObject < HybridMonitoringConfigurationResource > ( registeredServerResource . MonitoringConfiguration ) ;
294
+ var monitoringConfiguration = default ( HybridMonitoringConfigurationResource ) ;
295
+
296
+ if ( ! string . IsNullOrEmpty ( registeredServerResource . MonitoringConfiguration ) )
297
+ {
298
+ monitoringConfiguration = JsonConvert . DeserializeObject < HybridMonitoringConfigurationResource > ( registeredServerResource . MonitoringConfiguration ) ;
299
+ }
296
300
var registrationInfo = new ServerRegistrationInformation (
297
301
serviceEndpoint : registeredServerResource . ManagementEndpointUri ,
298
302
subscriptionId : subscriptionId ,
0 commit comments