@@ -267,7 +267,8 @@ public async Async.Task<VMExtensionWrapper> AgentConfig(AzureLocation region, Os
267267 await UpdateManagedScripts ( ) ;
268268 var urlsUpdated = urls ?? new ( ) ;
269269
270- var managedIdentity = JsonSerializer . Serialize ( new { ManagedIdentity = new Dictionary < string , string > ( ) } , _extensionSerializerOptions ) ;
270+ var managedIdentity = withSas ? null : new BinaryData ( JsonSerializer . Serialize ( new { ManagedIdentity = new Dictionary < string , string > ( ) } , _extensionSerializerOptions ) ) ;
271+
271272 if ( vmOs == Os . Windows ) {
272273 var vmScripts = await ConfigUrl ( WellKnownContainers . VmScripts , "managed.ps1" , withSas ) ?? throw new Exception ( "failed to get VmScripts config url" ) ;
273274 var toolsAzCopy = await ConfigUrl ( WellKnownContainers . Tools , "win64/azcopy.exe" , withSas ) ?? throw new Exception ( "failed to get toolsAzCopy config url" ) ;
@@ -290,7 +291,7 @@ public async Async.Task<VMExtensionWrapper> AgentConfig(AzureLocation region, Os
290291 TypeHandlerVersion = "1.9" ,
291292 AutoUpgradeMinorVersion = true ,
292293 Settings = new BinaryData ( JsonSerializer . Serialize ( new { commandToExecute = toExecuteCmd , fileUris = urlsUpdated } , _extensionSerializerOptions ) ) ,
293- ProtectedSettings = new BinaryData ( managedIdentity )
294+ ProtectedSettings = managedIdentity
294295 } ;
295296 return extension ;
296297 } else if ( vmOs == Os . Linux ) {
@@ -315,7 +316,7 @@ public async Async.Task<VMExtensionWrapper> AgentConfig(AzureLocation region, Os
315316 ForceUpdateTag = Guid . NewGuid ( ) . ToString ( ) ,
316317 AutoUpgradeMinorVersion = true ,
317318 Settings = new BinaryData ( extensionSettings ) ,
318- ProtectedSettings = new BinaryData ( managedIdentity )
319+ ProtectedSettings = managedIdentity
319320 } ;
320321 return extension ;
321322 }
0 commit comments