3

我有一个带有 5 个扩展的规模集。其中 2 个用于 Service Profiler,用于安装 .net 4.6.1,以及用于 Service Profiler 代理本身。当我部署具有所有 5 个扩展的模板时,由于(我认为..).net 安装需要重新启动 vm,模板将始终导致状态为失败。但是,它似乎并没有真正失败,因为当 vm 重新启动时,它会恢复任何尚未完成的扩展(再次,我认为.. 不幸的是,我的项目无法测试这个具有应用程序 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"
          }
        ]
      }
    }
  }

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

"message": "{\r\n \"error\": {\r\n \"code\": \"OperationNotAllowed\",\r\n \"message\": \"VM Scale Set 扩展处理程序 'Microsoft.Azure.ServiceFabric.ServiceFabricNode' 只能在删除 VM 规模集时删除。\"\r\n }\r\n}" },

考虑到我不想删除任何东西,这似乎有点奇怪。而且,据我所知,在有关链接模板或其他任何地方的扩展的文档中,实际上没有任何内容......

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

4

2 回答 2

1

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

有一些请求要创建一个安装了最新 .Net 的平台映像(我想知道是否有任何市场映像已经有这个),我认为我们应该这样做。

于 2016-06-06T16:41:14.320 回答
1

这是我的完整规模集资源,在单个模板中包含所有扩展。本来没用的,现在可以了。。。

{
  "apiVersion": "[variables('vmssApiVersion')]",
  "type": "Microsoft.Compute/virtualMachineScaleSets",
  "name": "[parameters('vmNodeType0Name')]",
  "location": "[variables('computeLocation')]",
  "tags": {
    "resourceType": "node",
    "environmentName": "[parameters('prefix')]",
    "displayName": "[parameters('vmNodeType0DisplayName')]"
  },
  "dependsOn": [
    "storageLoop",
    "[variables('lbID0')]",
    "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
    "[concat('Microsoft.Storage/storageAccounts/', variables('supportLogStorageAccountName'))]",
    "[concat('Microsoft.Storage/storageAccounts/', variables('applicationDiagnosticsStorageAccountName'))]",
    "[concat('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'))]",
    "[concat('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'),'/Modules/',variables('dscModules').xNetworking.ModuleName)]",
    "[concat('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'),'/Configurations/', parameters('configurationName'))]"
  ],
  "properties": {
    "overprovision": "[parameters('overProvision')]",
    "upgradePolicy": {
      "mode": "Automatic"
    },
    "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"
          },
          {
            "name": "[concat(parameters('vmNodeType0Name'),'_ServiceFabricNode')]",
            "properties": {
              "type": "ServiceFabricNode",
              "autoUpgradeMinorVersion": false,
              "protectedSettings": {
                "StorageAccountKey1": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('supportLogStorageAccountName')),'2015-05-01-preview').key1]",
                "StorageAccountKey2": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('supportLogStorageAccountName')),'2015-05-01-preview').key2]"
              },
              "publisher": "Microsoft.Azure.ServiceFabric",
              "settings": {
                "clusterEndpoint": "[reference(parameters('clusterName')).clusterEndpoint]",
                "nodeTypeRef": "[parameters('vmNodeType0Name')]",
                "dataPath": "D:\\\\SvcFab",
                "durabilityLevel": "Bronze",
                "certificate": {
                  "thumbprint": "[parameters('certificateThumbprint')]",
                  "x509StoreName": "[parameters('certificateStoreValue')]"
                }
              },
              "typeHandlerVersion": "1.0"
            }
          },
          {
            "name": "[concat('VMDiagnosticsVmExt','_vmNodeType0Name')]",
            "properties": {
              "type": "IaaSDiagnostics",
              "autoUpgradeMinorVersion": true,
              "protectedSettings": {
                "storageAccountName": "[variables('applicationDiagnosticsStorageAccountName')]",
                "storageAccountKey": "[listkeys(variables('accountid'), '2015-05-01-preview').key1]",
                "storageAccountEndPoint": "https://core.windows.net/"
              },
              "publisher": "Microsoft.Azure.Diagnostics",
              "settings": {
                "WadCfg": {
                  "DiagnosticMonitorConfiguration": {
                    "overallQuotaInMB": "50000",
                    "EtwProviders": {
                      "EtwEventSourceProviderConfiguration": [
                        {
                          "provider": "Microsoft-ServiceFabric-Actors",
                          "scheduledTransferKeywordFilter": "1",
                          "scheduledTransferPeriod": "PT5M",
                          "DefaultEvents": {
                            "eventDestination": "ServiceFabricReliableActorEventTable"
                          }
                        },
                        {
                          "provider": "Microsoft-ServiceFabric-Services",
                          "scheduledTransferPeriod": "PT5M",
                          "DefaultEvents": {
                            "eventDestination": "ServiceFabricReliableServiceEventTable"
                          }
                        }
                      ],
                      "EtwManifestProviderConfiguration": [
                        {
                          "provider": "cbd93bc2-71e5-4566-b3a7-595d8eeca6e8",
                          "scheduledTransferLogLevelFilter": "Information",
                          "scheduledTransferKeywordFilter": "4611686018427387904",
                          "scheduledTransferPeriod": "PT5M",
                          "DefaultEvents": {
                            "eventDestination": "ServiceFabricSystemEventTable"
                          }
                        }
                      ]
                    }
                  }
                },
                "StorageAccount": "[variables('applicationDiagnosticsStorageAccountName')]"
              },
              "typeHandlerVersion": "1.5"
            }
          },
          {
            "name": "Microsoft.Powershell.DSC",
            "properties": {
              "publisher": "Microsoft.Powershell",
              "type": "DSC",
              "typeHandlerVersion": "2.17",
              "autoUpgradeMinorVersion": true,
              "protectedSettings": {
                "Items": {
                  "registrationKeyPrivate": "[parameters('registrationKey')]"
                }
              },
              "settings": {
                "WmfVersion": "latest",
                "ModulesUrl": "https://raw.github.com/Azure/azure-quickstart-templates/master/201-vmss-automation-dsc/UpdateLCMforAAPull.zip",
                "SasToken": "[parameters('_artifactsLocationSasToken')]",
                "ConfigurationFunction": "UpdateLCMforAAPull.ps1\\ConfigureLCMforAAPull",
                "Properties": [
                  {
                    "Name": "RegistrationKey",
                    "Value": {
                      "UserName": "[parameters('adminUserName')]",
                      "Password": "PrivateSettingsRef:registrationKeyPrivate"
                    },
                    "TypeName": "System.Management.Automation.PSCredential"
                  },
                  {
                    "Name": "RegistrationUrl",
                    "Value": "[parameters('registrationUrl')]",
                    "TypeName": "System.String"
                  },
                  {
                    "Name": "NodeConfigurationName",
                    "Value": "[parameters('nodeConfigurationName')]",
                    "TypeName": "System.String"
                  },
                  {
                    "Name": "ConfigurationMode",
                    "Value": "[parameters('configurationMode')]",
                    "TypeName": "System.String"
                  },
                  {
                    "Name": "ConfigurationModeFrequencyMins",
                    "Value": "[parameters('configurationModeFrequencyMins')]",
                    "TypeName": "System.Int32"
                  },
                  {
                    "Name": "RefreshFrequencyMins",
                    "Value": "[parameters('refreshFrequencyMins')]",
                    "TypeName": "System.Int32"
                  },
                  {
                    "Name": "RebootNodeIfNeeded",
                    "Value": "[parameters('rebootNodeIfNeeded')]",
                    "TypeName": "System.Boolean"
                  },
                  {
                    "Name": "ActionAfterReboot",
                    "Value": "[parameters('actionAfterReboot')]",
                    "TypeName": "System.String"
                  },
                  {
                    "Name": "AllowModuleOverwrite",
                    "Value": "[parameters('allowModuleOverwrite')]",
                    "TypeName": "System.Boolean"
                  },
                  {
                    "Name": "Timestamp",
                    "Value": "[parameters('timestamp')]",
                    "TypeName": "System.String"
                  }
                ]
              }
            }
          }
        ]
      },
      "networkProfile": {
        "networkInterfaceConfigurations": [
          {
            "name": "[concat(variables('nicName'), '-0')]",
            "properties": {
              "ipConfigurations": [
                {
                  "name": "[concat(variables('nicName'),'-',0)]",
                  "properties": {
                    "loadBalancerBackendAddressPools": [
                      {
                        "id": "[variables('lbPoolID0')]"
                      }
                    ],
                    "loadBalancerInboundNatPools": [
                      {
                        "id": "[variables('lbNatPoolID0')]"
                      }
                    ],
                    "subnet": {
                      "id": "[variables('subnet0Ref')]"
                    }
                  }
                }
              ],
              "primary": true
            }
          }
        ]
      },
      "osProfile": {
        "adminPassword": "[parameters('adminPassword')]",
        "adminUsername": "[parameters('adminUsername')]",
        "computernamePrefix": "[parameters('vmNodeType0Name')]",
        "secrets": [
          {
            "sourceVault": {
              "id": "[parameters('sourceVaultValue')]"
            },
            "vaultCertificates": [
              {
                "certificateStore": "[parameters('certificateStoreValue')]",
                "certificateUrl": "[parameters('certificateUrlValue')]"
              }
            ]
          }
        ]
      },
      "storageProfile": {
        "imageReference": {
          "publisher": "[parameters('vmImagePublisher')]",
          "offer": "[parameters('vmImageOffer')]",
          "sku": "[parameters('vmImageSku')]",
          "version": "[parameters('vmImageVersion')]"
        },
        "osDisk": {
          "vhdContainers": [
            "[concat('https://', variables('uniqueStringArray')[0], '.blob.core.windows.net/', parameters('vmStorageAccountContainerNameType0'))]",
            "[concat('https://', variables('uniqueStringArray')[1], '.blob.core.windows.net/', parameters('vmStorageAccountContainerNameType0'))]",
            "[concat('https://', variables('uniqueStringArray')[2], '.blob.core.windows.net/', parameters('vmStorageAccountContainerNameType0'))]",
            "[concat('https://', variables('uniqueStringArray')[3], '.blob.core.windows.net/', parameters('vmStorageAccountContainerNameType0'))]",
            "[concat('https://', variables('uniqueStringArray')[4], '.blob.core.windows.net/', parameters('vmStorageAccountContainerNameType0'))]"
          ],
          "name": "vmssosdisk",
          "caching": "ReadOnly",
          "createOption": "FromImage"
        }
      }
    }
  },
  "sku": {
    "name": "[parameters('vmNodeType0Size')]",
    "capacity": "5",
    "tier": "Standard"
  }
}
于 2016-06-10T10:19:13.133 回答