ResourceExtension [SPFSDK][VMROLE]

 

适用于:Windows Azure Pack

资源扩展是一个版本控制模板,用于描述如何在资源定义描述的资源中安装和配置资源。

类型层次结构

ResourceExtension

语法

{
    "SchemaVersion": "1.0",

    "Name": "string",
    "Version": "string in version format",
    "Publisher": "string",


    "ExtensionType" : "Microsoft.Compute/EnterpiseApplicationExtension/1.0",

    "DataPackage": {
        "Version": "1.0.0.0",
        "Location": "MyTemplatePayload",
        "ExternalPayload": [
            {
                "RelativePath": "string",
                "Hash": "string",
                "URLHint": "string"
            }
        ]
    },

    "ResourceExtensionParameters": { <ResourceExtensionParameters> },
    "ResourceRequirements": { <ResourceRequirements> },

    "ExtensionSettings": {


        "ApplicationProfile": { <ApplicationProfile> }
    }
}

属性

名称

类型

必须

默认值

说明

schemaVersion

字符串

资源扩展架构的版本。 必须始终设置为 1.0

名称

String

此资源扩展的名称。

版本

String

资源扩展的版本。 版本的格式为: <主要>版本。<次要>。<build>。<release>. 例如 6.33.2.10。

Publisher

字符串

资源扩展的发布者。

ExtensionType

字符串

承载此资源扩展的协定的名称。 标识哪些资源可以支持此资源扩展。 必须设置为 Microsoft.Compute/EnterpiseApplicationExtension/1.0

DataPackage

DataPackage

Null

包使用的有效负载的位置。

ResourceExtensionParameters

参数和类型的数组 [SPFSDK][VMROLE]

Null

资源扩展声明的参数数组。

ResourceRequirements

ResourceRequirements [SPFSDK][VMROLE]

Null

资源扩展在其资源中具有的要求。

ExtensionSettings

ExtensionSettings [SPFSDK][VMROLE]

托管虚拟机的应用程序和来宾内配置。

DataPackage

名称

类型

必须

默认值

说明

版本

String

数据包的版本。 版本的格式为: <主要>版本。<次要>。<build>。<release>. 例如 6.33.2.10。

位置

字符串

包含扩展有效负载的资源扩展包存档中的相对路径。

ExternalPayload

ExternalPayload 数组

资源扩展要求不作为资源扩展包存档的一部分重新分发的文件。

ExternalPayload

名称

类型

必须

默认值

说明

RelativePath

字符串

文件所在的资源扩展包中的相对路径。

哈希

字符串

外部有效负载文件的 SHA256 哈希。

URLHint

字符串

可用于下载外部有效负载文件的 URL。

备注

下面的代码示例提供了一个示例 ResourceExtension 对象。

{
    "Name": "MyVirtualMachineRoleExtension",
    "Version": "Version of the resource extension",
    "Publisher": "Publisher of Extension",

    "SchemaVersion": "1.0",

    "ExtensionType": "Microsoft.Compute/ EnterpiseApplicationExtension/1.0",

    "DataPackage": {
        "Version": "1.0.0.0",
        "Location": "MyTemplatePayload",
        "ExternalPayload": [
            {
                "RelativePath": "sharepoint.msi",
                "Hash": "...",
                "URLHint": "http://<webpage-to-download-sharepoint>"
            }
        ]
    },

    "ResourceExtensionParameters": [
        {
            "Name": "SQLInstance",
            "Type": "string",
            "Description": "my description"
        },
        {
            "Name": "ConnectionString",
            "Type": "string",
            "Description": "my description"
        },
        {
            "Name": "SharepointDB",
            "Type": "string",
            "Description": "my description"
        }
    ],

    "ResourceRequirements": {
        "OSVirtualHardDiskRequirements": [
            "WS2008",
            "SysprepSQL"
        ],
    },

    "ExtensionSettings": {



        "ApplicationProfile": {
            "Name": "ApplicationProfile1",

            "ApplicationPayload": [
                {
                    "ID": "49c1ccdb-9068-4b91-9409-0a7ca8a1d291",
                    "RelativePath": "sharepointfiles"
                }
            ],

            "LinuxApplicationProfile": {
                "RunOnceCommands": [
                    "ifconfig"
                ]
            },

            "WindowsApplicationProfile": {
                "WindowsServerRolesAndFeatures": [
                    "TFTP-Client"
                ],

                "SQLProfile": {
                    "SQLDeployments": [
                        {
                            "DeploymentName": "SQL Deployment 1",
                            "InstanceName": "[Param.SQLInstance]",
                            "InstanceID": "[Param.SQLInstance]",
                            "EnableNamedPipes": false,
                            "EnableTCP": true,
                            "MediaSource": "c:\\SQLMediaPath\\sqlsetup.exe",
                            "ProductKey": "abcdefghijklmnopqrstuvwxyz",
                            "SQLAuthenticationType": "WindowsAuthentication",
                            "SQLSysAdminMemberList": "domain\\user",
                            "DeploymentTimeOutInSeconds": 3600,
                            "SQLConfigurationPayloadId": "61A33949-46CE-4d0f-921F-A0059DA9AD1F",
                            "SAPassword": "MySAPassword",

                            "SQLDeploymentCredential": "domain\\user:password",
                            "SQLAgentServiceCredential": "NT AUTHORITY\\System:",
                            "SQLServiceCredential": "NT AUTHORITY\\NetworkService:",
                            "SQLReportingServiceCredential": "domain\\user:password"
                        }
                    ]
                },

                "ProvisioningScripts": [
                    {
                        "AlwaysReboot": false,
                        "ApplicationPayloadId": "49c1ccdb-9068-4b91-9409-0a7ca8a1d291",
                        "DeploymentOrder": 1,
                        "ErrorPolicy": "FailOnMatch",
                        "ExecutableAndParams": {
                            "Executable": "cmd.exe",
                            "Parameters": "/q /c msiexec sharepoint.msi"
                        },
                        "ExitCodeRegex": "[1-9][0-9]*",
                        "MaxOutputSize": 1048576,
                        "RebootExitCodeRegex": "{1641}|{3010}|{3011}",
                        "RestartOnRetry": false,
                        "ScriptBlock": null,
                        "ScriptCredential": "domain\\user:password",
                        "ScriptType": "PreInstall",
                        "StandardErrorPath": "c:\\err.txt",
                        "StandardErrorRegex": ".+",
                        "StandardInput": null,
                        "StandardOutputPath": "c:\\out.txt",
                        "StandardOutputRegex": null,
                        "TimeoutInSeconds": 900,
                        "WorkingDirectory": null
                    }
                ],
                "WebDeployApplications": [
                    {
                        "DeploymentName": "WebDeploy App 1",

                        "ScriptCommands": [
                            {
                                "AlwaysReboot": false,
                                "ApplicationPayloadId": "366819c2-bf11-4c85-9555- 6293e2a3ce7b",
                                "ErrorPolicy": "FailOnMatch",
                                "ExecutableAndParams": {
                                    "Executable": "cmd.exe",
                                    "Parameters": "/q /c installwebdeploy.cmd"
                                },
                                "ExitCodeRegex": "[1-9][0-9]*",
                                "MaxOutputSize": 1048576,
                                "RebootExitCodeRegex": "{1641}|{3010}|{3011}",
                                "RestartOnRetry": false,
                                "ScriptBlock": null,
                                "ScriptCredential": "domain\\user:password",
                                "ScriptType": "PreInstall",
                                "StandardErrorPath": "c:\\err.txt",
                                "StandardErrorRegex": ".+",
                                "StandardInput": null,
                                "StandardOutputPath": "c:\\out.txt",
                                "StandardOutputRegex": null,
                                "TimeoutInSeconds": 900,
                                "WorkingDirectory": null
                            }
                        ],

                        "DeploymentName": "Deployment1",
                        "ApplicationPayloadId": "371ade4c-03a2-492d-9589-b399b940e44f",
                        "PackagePassword": "mypassword2",
                        "WebDeployParameters": [
                            {
                                "ParameterName": "CONNECTION_STRING",
                                "Value": "[Param.ConnectionString]"
                            }
                        ]
                    }
                ],

                "SQLDacApplications": [
                    {
                        "DeploymentName": "SQL App 1",

                        "ScriptCommands": [
                            {
                                "AlwaysReboot": false,
                                "ApplicationPayloadId": null,
                                "ErrorPolicy": "FailOnMatch",
                                "ExecutableAndParams": null,
                                "ExitCodeRegex": "[1-9][0-9]*",
                                "MaxOutputSize": 1048576,
                                "RebootExitCodeRegex": "{1641}|{3010}|{3011}",
                                "RestartOnRetry": false,
                                "ScriptBlock": "rem some script that needs to run before sqldac package is installed",
                                "ScriptCredential": {
                                    "Password": "mypassword4",
                                    "UserName": "dcmanagerlab\\esdcvsec4"
                                },
                                "ScriptType": "PreInstall",
                                "StandardErrorPath": "c:\\err.txt",
                                "StandardErrorRegex": ".+",
                                "StandardInput": null,
                                "StandardOutputPath": "c:\\out.txt",
                                "StandardOutputRegex": null,
                                "TimeoutInSeconds": 900,
                                "WorkingDirectory": null
                            }
                        ],

                        "SQLScriptCommands": [
                            {
                                "DatabaseName": "[Param.SharepointDB]",
                                "DeploymentOrder": 1,
                                "EncryptConnection": false,
                                "ExecutionTimeoutSeconds": 500,
                                "LoginTimeoutSeconds": 50,
                                "OutputFilePath": "c:\\sharepointDB.sql.log",
                                "SQLAuthenticationType": "WindowsAuthentication",
                                "SQLScriptApplicationPayloadId": "db04416b-d0a8-44d5-b0ee-d5739378a98d",
                                "ScriptCredential": "[Param.SQLScriptCommandCredential]",
                                "ScriptType": "PostInstall"
                            }
                        ],

                        "DeploymentName": "Deployment1",
                        "ApplicationPayloadId": "5b064b6a-d6d0-48f0-8979-9aafc676a9e5",
                        "BlockOnChanges": false,
                        "DacInstance": "[Param.SharepointDB]",
                        "IgnoreDataLoss": false,
                        "RollbackOnFailure": true,
                        "SQLAuthenticationType": "WindowsAuthentication",

                        "SQLDeploymentCredential": "[param.SQLDeploymentCredential]",

                        "SQLInstance": "[Param.SQLInstance]",
                        "SkipPolicyValidation": true,
                        "UninstallMode": "DropDatabase"
                    }
                ],

                "ScriptApplications": [
                    {
                        "DeploymentName": "ScriptDeployment1",

                        "ScriptCommands": [
                            {
                                "AlwaysReboot": false,
                                "ApplicationPayloadId": "366819c2-bf11-4c85-9555- 6293e2a3ce7b",
                                "ErrorPolicy": "FailOnMatch",
                                "ExecutableAndParams": {
                                    "Executable": "cmd.exe",
                                    "Parameters": "/q /c installwebdeploy.cmd"
                                },
                                "ExitCodeRegex": "[1-9][0-9]*",
                                "MaxOutputSize": 1048576,
                                "RebootExitCodeRegex": "{1641}|{3010}|{3011}",
                                "RestartOnRetry": false,
                                "ScriptBlock": null,
                                "ScriptCredential": "domain\\user:mypassword",
                                "ScriptType": "PreInstall",
                                "StandardErrorPath": "c:\err.txt",
                                "StandardErrorRegex": ".+",
                                "StandardInput": null,
                                "StandardOutputPath": "c:\out.txt",
                                "StandardOutputRegex": null,
                                "TimeoutInSeconds": 900,
                                "WorkingDirectory": null
                            }
                        ],

                        "EnvironmentVariables": [
                            {
                                "Name": "envvar1",
                                "Value": "foo",
                            },
                            {
                                "Name": "envvar2",
                                "Value": "bar",
                            },
                        ],

                        "AlwaysReboot": false,
                        "ApplicationPayloadId": "49c1ccdb-9068-4b91-9409-0a7ca8a1d291",
                        "ErrorPolicy": "FailOnMatch",
                        "ExecutableAndParams": {
                            "Executable": "cmd.exe",
                            "Parameters": "/q /c msiexec sharepoint.msi"
                        },
                        "ExitCodeRegex": "[1-9][0-9]*",
                        "MaxOutputSize": 1048576,
                        "RebootExitCodeRegex": "{1641}|{3010}|{3011}",
                        "ScriptBlock": null,
                        "ScriptCredential": "username:password",
                        "StandardErrorPath": "c:\err.txt",
                        "StandardErrorRegex": ".+",
                        "StandardInput": null,
                        "StandardOutputPath": "c:\out.txt",
                        "StandardOutputRegex": null,
                        "TimeoutInSeconds": 900,
                        "WorkingDirectory": null
                    }
                ]
            }
        }
    }
}

另请参阅

VM 角色 JSON 参考 [SPFSDK][VMROLE]
VirtualMachineRole (实例) [SPFSDK][VMROLE]
ResourceDefinition [SPFSDK][VMROLE]
ResourceConfiguration [SPFSDK][VMROLE]
参数和类型 [SPFSDK][VMROLE]
ResourceRequirements [SPFSDK][VMROLE]
ExtensionSettings [SPFSDK][VMROLE]