在 Azure 中创建管理解决方案的最佳做法(预览版)Best practices for creating management solutions in Azure (Preview)

备注

这是在 Azure 中创建管理解决方案(当前处于预览状态)的初步文档。This is preliminary documentation for creating management solutions in Azure which are currently in preview. 如下所述的全部架构均会有变动。Any schema described below is subject to change.

本文提供在 Azure 中创建管理解决方案文件的最佳做法。This article provides best practices for creating a management solution file in Azure. 发现其他最佳做法后,将更新此信息。This information will be updated as additional best practices are identified.

数据源Data sources

  • 数据源可以使用 Resource Manager 模板进行配置,但它们不应包含在解决方案文件中。Data sources can be configured with a Resource Manager template, but they should not be included in a solution file. 原因是,数据源配置当前是不幂等的,这意味着解决方案可以覆盖用户工作区中的现有配置。The reason is that configuring data sources is not currently idempotent meaning that your solution could overwrite existing configuration in the user's workspace.

    例如,解决方案可能需要应用程序事件日志中的警告和错误事件。For example, your solution may require Warning and Error events from the Application event log. 如果在解决方案中将此项指定为数据源,则当用户已在其工作区中配置此项时,可能会删除信息事件。If you specify this as a data source in your solution, you risk removing Information events if the user had this configured in their workspace. 如果包含所有事件,则可能会在用户的工作区中收集过多信息事件。If you included all events, then you may be collecting excessive Information events in the user's workspace.

  • 如果解决方案需要来自某个标准数据源的数据,则应将此数据源定义为先决条件。If your solution requires data from one of the standard data sources, then you should define this as a prerequisite. 在文档中声明:客户必须自己配置数据源。State in documentation that the customer must configure the data source on their own.

  • 向解决方案中的任何视图添加数据流验证消息,以针对需要为待收集的所需数据而配置的数据源向用户提供指示。Add a Data Flow Verification message to any views in your solution to instruct the user on data sources that need to be configured for required data to be collected. 找不到所需的数据时,此消息会显示在视图的磁贴上。This message is displayed on the tile of the view when required data is not found.

RunbookRunbooks

  • 为解决方案中需要按计划运行的每个 runbook 添加自动化计划Add an Automation schedule for each runbook in your solution that needs to run on a schedule.
  • 在解决方案中包括 IngestionAPI 模块,以供将数据写入到 Log Analytics 存储库的 runbook 使用。Include the IngestionAPI module in your solution to be used by runbooks writing data to the Log Analytics repository. 将解决方案配置为引用此资源,以便在删除了解决方案后,此资源仍保留。Configure the solution to reference this resource so that it remains if the solution is removed. 这就可以让多个解决方案共享此模块。This allows multiple solutions to share the module.
  • 使用自动化变量为解决方案提供用户以后可能要更改的值。Use Automation variables to provide values to the solution that users may want to change later. 即使解决方案配置为包含该变量,则仍可以更改该变量的值。Even if the solution is configured to contain the variable, it's value can still be changed.

视图Views

  • 所有解决方案都应包含在用户门户中显示的单一视图。All solutions should include a single view that is displayed in the user's portal. 该视图可以包含多个可视化效果部件以演示不同数据集。The view can contain multiple visualization parts to illustrate different sets of data.
  • 向解决方案中的任何视图添加数据流验证消息,以针对需要为待收集的所需数据而配置的数据源向用户提供指示。Add a Data Flow Verification message to any views in your solution to instruct the user on data sources that need to be configured for required data to be collected.
  • 将解决方案配置为包含该视图,因此如果删除解决方案,它也会被删除。Configure the solution to contain the view so that it's removed if the solution is removed.

警报Alerts

  • 在解决方案文件中将收件人列表定义为参数,以便用户在安装解决方案时可以定义它们。Define the recipients list as a parameter in the solution file so the user can define them when they install the solution.
  • 将解决方案配置为引用警报规则,以便用户可以更改其配置。Configure the solution to reference alert rules so that user's can change their configuration. 他们可能想要进行更改,例如修改收件人列表、更改警报的阈值或禁用警报规则。They may want to make changes such as modifying the recipient list, changing the threshold of the alert, or disabling the alert rule.

后续步骤Next steps