我有一个带有 5 个扩展的秤集。其中 2 个用于 Service Profiler,用于安装 .net 4.6.1,以及用于 Service Profiler 代理本身。当我部署包含所有 5 个扩展的模板时,由于(我认为..).net 安装需要重新启动虚拟机,模板将始终导致失败状态。然而,它似乎并没有真正失败,因为当虚拟机重新启动时,它会恢复任何尚未完成的扩展(再次,我认为..不幸的是,我的项目无法测试这个具有应用程序 atm 的基础设施)。

因此,我尝试将 2 个服务分析器扩展移动到链接模板,因此规模集的状态将变为成功,并且此后的操作不会受到影响。 (以及模板中依赖于规模集的其他资源,我假设如果基础设施部署“失败”,则不会发生来自 VSTS 发布管理器的应用程序部署。)

因此,我的链接模板仅具有规模集资源,但仅定义了扩展:

"resources": [ 
{ 
  "apiVersion": "2016-03-30", 
  "type": "Microsoft.Compute/virtualMachineScaleSets", 
  "name": "[variables('vmNodeType0Name')]", 
  "location": "[resourceGroup().location]", 
  "properties": { 
    "virtualMachineProfile": { 
      "extensionProfile": { 
        "extensions": [ 
          { 
            "properties": { 
              "publisher": "Microsoft.Compute", 
              "type": "CustomScriptExtension", 
              "typeHandlerVersion": "1.7", 
              "autoUpgradeMinorVersion": false, 
              "settings": { 
                "fileUris": [ "https://serviceprofiler.azurewebsites.net/content/downloads/InstallNetFx46.ps1" ], 
                "commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted -File InstallNetFx46.ps1" 
              }, 
              "forceUpdateTag": "RerunExtension" 
            }, 
            "name": "CustomScriptExtensionInstallNet46" 
          }, 
          { 
            "properties": { 
              "publisher": "Microsoft.VisualStudio.ServiceProfiler", 
              "type": "ServiceProfilerAgent", 
              "typeHandlerVersion": "0.1", 
              "autoUpgradeMinorVersion": true, 
              "settings": { 
                "config": { 
                  "ServiceName": "<nameChanged>", 
                  "CircularEtlBufferMB": 200, 
                  "MonitorSamplingRate": 1.0, 
                  "ProfileSamplingRate": 0.05, 
                  "AgentLogFilter": "Warning", 
                  "ProvideUsageTelemetryData": true, 
                  "EtwMetrics": [ 
                    { 
                      "ProviderName": "Microsoft-ServiceFabric-Actors", 
                      "ProviderKeywords": 2, 
                      "ProviderLevel": "Verbose", 
                      "Event": "ActorMethod/Start", 
                      "EventStop": "ActorMethod/Stop", 
                      "Name": "methodName" 
                    }, 
                    { 
                      "ProviderName": "Microsoft-ServiceFabric-Actors", 
                      "ProviderKeywords": 4, 
                      "ProviderLevel": "Verbose", 
                      "Event": "ActorSaveState/Start", 
                      "EventStop": "ActorSaveState/Stop", 
                      "Name": "actorType" 
                    }, 
                    { 
                      "ProviderName": "<nameChanged>", 
                      "ProviderKeywords": 0, 
                      "ProviderLevel": "Informational", 
                      "Event": "Request/Start", 
                      "EventStop": "Request/Stop", 
                      "Name": "url" 
                    } 
                  ], 
                  "Tags": [ 
                    { 
                      "Type": "Performance", 
                      "Settings": { 
                        "SampleIntervalInSeconds": "5", 
                        "SamplesToConsider": "6", 
                        "Triggers": [ 
                          { 
                            "Name": "High CPU", 
                            "Description": "High CPU usage", 
                            "PerfCounter": "Processor Information\\% Processor Time\\_Total", 
                            "Operator": ">", 
                            "Metric": "70" 
                          }, 
                          { 
                            "Name": "Busy Disk", 
                            "Description": "High disk usage", 
                            "PerfCounter": "PhysicalDisk\\% Disk Time\\_Total", 
                            "Operator": ">", 
                            "Metric": "10" 
                          }, 
                          { 
                            "Name": "Memory Pressure", 
                            "Description": "High memory usage", 
                            "PerfCounter": "Memory\\Available MBytes", 
                            "Operator": "<", 
                            "Metric": "400" 
                          }, 
                          { 
                            "Name": "High GC", 
                            "Description": "High GC time", 
                            "PerfCounter": ".NET CLR Memory\\% Time in GC\\_Global_", 
                            "Operator": ">", 
                            "Metric": "10" 
                          } 
                        ] 
                      } 
                    }, 
                    { 
                      "Type": "Version", 
                      "Settings": { 
                        "Source": { 
                          "Type": "ServiceFabric" 
                        } 
                      } 
                    } 
                  ] 
                } 
              }, 
              "protectedSettings": { 
                "storageAccountName": "[variables('applicationDiagnosticsStorageAccountName')]", 
                "storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('applicationDiagnosticsStorageAccountName')),'2015-05-01-preview').key1]", 
                "storageAccountEndPoint": "https://core.windows.net/" 
              } 
            }, 
            "name": "ServiceProfilerAgent" 
          } 
        ] 
      } 
    } 
  } 

但是,我收到此错误消息:

"消息": "{\r\n\"错误\": {\r\n\"代码\":\"不允许操作\",\r\n\"消息\":\"虚拟机规模仅在删除 VM 规模集时才能删除处理程序“Microsoft.Azure.ServiceFabric.ServiceFabricNode”的集扩展。\"\r\n }\r\n}" },

考虑到我并没有尝试删除任何内容,这似乎有点奇怪。据我所知,ofc 在链接模板或其他任何地方的扩展文档中几乎没有任何内容......

这是否支持?或者我应该把它留在 1 个模板中? 任何帮助都会很棒!

请您参考如下方法:

有关删除扩展程序的错误消息是因为扩展程序列表是作为一个整体应用的,因此如果您没有两个原始扩展程序(来自主模板),它会认为您正在删除它们。 IE。您需要在列表中包含所有 4 个扩展名。 评论中关于使用安装了 .Net 的自定义镜像的建议是一个很好的建议。获取计算机信息的另一个选项是使用 customData 属性 - 尽管它可能对这种特定情况没有帮助。

有人请求创建安装了最新 .Net 的平台镜像(我想知道是否有任何市场镜像已经具有此功能),我认为我们应该这样做。


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!