ARM部署错误-需要建议如何解决

时间:2019-06-24 23:58:31

标签: azure azure-resource-manager arm-template

我正在尝试使用Powershell ISE部署ARM模板。开头deploy.ps文件中的代码:

这是deploy.ps文件的代码:

<#
 .SYNOPSIS
    Deploys a template to Azure

 .DESCRIPTION
    Deploys an Azure Resource Manager template

 .PARAMETER subscriptionId
    The subscription id where the template will be deployed.

 .PARAMETER resourceGroupName
    The resource group where the template will be deployed. Can be the name of an existing or a new resource group.

 .PARAMETER resourceGroupLocation
    Optional, a resource group location. If specified, will try to create a new resource group in this location. If not specified, assumes resource group is existing.

 .PARAMETER deploymentName
    The deployment name.

 .PARAMETER templateFilePath
    Optional, path to the template file. Defaults to template.json.

 .PARAMETER parametersFilePath
    Optional, path to the parameters file. Defaults to parameters.json. If file is not found, will prompt for parameter values based on template.
#>

param(
 [Parameter(Mandatory=$True)]
 [string]
 $subscriptionId,

 [Parameter(Mandatory=$True)]
 [string]
 $resourceGroupName,

 [string]
 $resourceGroupLocation,

 [Parameter(Mandatory=$True)]
 [string]
 $deploymentName,

 [string]
 $templateFilePath = "template.json",

 [string]
 $parametersFilePath = "parameters.json"
)

<#
.SYNOPSIS
    Registers RPs
#>
Function RegisterRP {
    Param(
        [string]$ResourceProviderNamespace
    )

    Write-Host "Registering resource provider '$ResourceProviderNamespace'";
    Register-AzureRmResourceProvider -ProviderNamespace $ResourceProviderNamespace;
}

#******************************************************************************
# Script body
# Execution begins here
#******************************************************************************
$ErrorActionPreference = "Stop"

# sign in
Write-Host "Logging in...";
Login-AzureRmAccount;

# select subscription
Write-Host "Selecting subscription '$subscriptionId'";
Select-AzureRmSubscription -SubscriptionID $subscriptionId;

# Register RPs
$resourceProviders = @("microsoft.datalakeanalytics","microsoft.datalakestore","microsoft.devices","microsoft.storage","microsoft.streamanalytics","microsoft.web");
if($resourceProviders.length) {
    Write-Host "Registering resource providers"
    foreach($resourceProvider in $resourceProviders) {
        RegisterRP($resourceProvider);
    }
}

#Create or check for existing resource group
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue
if(!$resourceGroup)
{
    Write-Host "Resource group '$resourceGroupName' does not exist. To create a new resource group, please enter a location.";
    if(!$resourceGroupLocation) {
        $resourceGroupLocation = Read-Host "resourceGroupLocation";
    }
    Write-Host "Creating resource group '$resourceGroupName' in location '$resourceGroupLocation'";
    New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
}
else{
    Write-Host "Using existing resource group '$resourceGroupName'";
}

# Start the deployment
Write-Host "Starting deployment...";
if(Test-Path $parametersFilePath) {
    New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name $deploymentName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
} else {
    New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name $deploymentName -TemplateFile $templateFilePath;
}

这是template.json文件代码:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "accounts_iotdla753689d9_defaultDataLakeStoreAccount": {
            "defaultValue": null,
            "type": "SecureString"
        },
        "accounts_iotdla753689d9_dataLakeStoreAccounts": {
            "defaultValue": null,
            "type": "Array"
        },
        "sites_iot_func_753689D9_name": {
            "defaultValue": "iot-func-753689D9",
            "type": "String"
        },
        "serverfarms_CentralUSPlan_name": {
            "defaultValue": "CentralUSPlan",
            "type": "String"
        },
        "IotHubs_iot_hub_753689D9_name": {
            "defaultValue": "iot-hub-753689D9",
            "type": "String"
        },
        "accounts_iotdls753689d9_name": {
            "defaultValue": "iotdls753689d9",
            "type": "String"
        },
        "accounts_iotdla753689d9_name": {
            "defaultValue": "iotdla753689d9",
            "type": "String"
        },
        "storageAccounts_iotstoracc753689d9_name": {
            "defaultValue": "iotstoracc753689d9",
            "type": "String"
        },
        "streamingjobs_iot_asa_753689D9_name": {
            "defaultValue": "iot-asa-753689D9",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.DataLakeAnalytics/accounts",
            "apiVersion": "2016-11-01",
            "name": "[parameters('accounts_iotdla753689d9_name')]",
            "location": "centralus",
            "properties": {
                "defaultDataLakeStoreAccount": "[parameters('accounts_iotdla753689d9_defaultDataLakeStoreAccount')]",
                "dataLakeStoreAccounts": "[parameters('accounts_iotdla753689d9_dataLakeStoreAccounts')]"
            }
        },
        {
            "type": "Microsoft.DataLakeStore/accounts",
            "apiVersion": "2016-11-01",
            "name": "[parameters('accounts_iotdls753689d9_name')]",
            "location": "centralus",
            "properties": {}
        },
        {
            "type": "Microsoft.Devices/IotHubs",
            "apiVersion": "2018-04-01",
            "name": "[parameters('IotHubs_iot_hub_753689D9_name')]",
            "location": "centralus",
            "sku": {
                "name": "S1",
                "tier": "Standard",
                "capacity": 1
            },
            "properties": {
                "operationsMonitoringProperties": {
                    "events": {
                        "None": "None",
                        "Connections": "None",
                        "DeviceTelemetry": "None",
                        "C2DCommands": "None",
                        "DeviceIdentityOperations": "None",
                        "FileUploadOperations": "None",
                        "Routes": "None"
                    }
                },
                "ipFilterRules": [],
                "eventHubEndpoints": {
                    "events": {
                        "retentionTimeInDays": 1,
                        "partitionCount": 4,
                        "partitionIds": [
                            "0",
                            "1",
                            "2",
                            "3"
                        ],
                        "path": "iot-hub-753689d9",
                        "endpoint": "sb://iothub-ns-iot-hub-75-1538681-1208d72a33.servicebus.windows.net/"
                    },
                    "operationsMonitoringEvents": {
                        "retentionTimeInDays": 1,
                        "partitionCount": 4,
                        "partitionIds": [
                            "0",
                            "1",
                            "2",
                            "3"
                        ],
                        "path": "iot-hub-753689d9-operationmonitoring",
                        "endpoint": "sb://iothub-ns-iot-hub-75-1538681-1208d72a33.servicebus.windows.net/"
                    }
                },
                "routing": {
                    "endpoints": {
                        "serviceBusQueues": [],
                        "serviceBusTopics": [],
                        "eventHubs": [],
                        "storageContainers": []
                    },
                    "routes": [],
                    "fallbackRoute": {
                        "name": "$fallback",
                        "source": "DeviceMessages",
                        "condition": "true",
                        "endpointNames": [
                            "events"
                        ],
                        "isEnabled": true
                    }
                },
                "storageEndpoints": {
                    "$default": {
                        "sasTtlAsIso8601": "PT1H",
                        "connectionString": "",
                        "containerName": ""
                    }
                },
                "messagingEndpoints": {
                    "fileNotifications": {
                        "lockDurationAsIso8601": "PT1M",
                        "ttlAsIso8601": "PT1H",
                        "maxDeliveryCount": 10
                    }
                },
                "enableFileUploadNotifications": false,
                "cloudToDevice": {
                    "maxDeliveryCount": 10,
                    "defaultTtlAsIso8601": "PT1H",
                    "feedback": {
                        "lockDurationAsIso8601": "PT1M",
                        "ttlAsIso8601": "PT1H",
                        "maxDeliveryCount": 10
                    }
                },
                "features": "None"
            }
        },
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2018-07-01",
            "name": "[parameters('storageAccounts_iotstoracc753689d9_name')]",
            "location": "centralus",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "Storage",
            "properties": {
                "networkAcls": {
                    "bypass": "AzureServices",
                    "virtualNetworkRules": [],
                    "ipRules": [],
                    "defaultAction": "Allow"
                },
                "supportsHttpsTrafficOnly": false,
                "encryption": {
                    "services": {
                        "file": {
                            "enabled": true
                        },
                        "blob": {
                            "enabled": true
                        }
                    },
                    "keySource": "Microsoft.Storage"
                }
            }
        },
        {
            "type": "Microsoft.StreamAnalytics/streamingjobs",
            "apiVersion": "2016-03-01",
            "name": "[parameters('streamingjobs_iot_asa_753689D9_name')]",
            "location": "Central US",
            "properties": {
                "sku": {
                    "name": "Standard"
                },
                "outputStartMode": "JobStartTime",
                "outputStartTime": "2019-04-23T23:01:09.69Z",
                "eventsOutOfOrderPolicy": "Adjust",
                "outputErrorPolicy": "Stop",
                "eventsOutOfOrderMaxDelayInSeconds": 0,
                "eventsLateArrivalMaxDelayInSeconds": 5,
                "dataLocale": "en-US",
                "compatibilityLevel": "1.0"
            }
        },
        {
            "type": "Microsoft.Web/serverfarms",
            "apiVersion": "2016-09-01",
            "name": "[parameters('serverfarms_CentralUSPlan_name')]",
            "location": "Central US",
            "sku": {
                "name": "Y1",
                "tier": "Dynamic",
                "size": "Y1",
                "family": "Y",
                "capacity": 0
            },
            "kind": "functionapp",
            "properties": {
                "name": "[parameters('serverfarms_CentralUSPlan_name')]",
                "perSiteScaling": false,
                "reserved": false,
                "targetWorkerCount": 0,
                "targetWorkerSizeId": 0
            }
        },
        {
            "type": "Microsoft.DataLakeAnalytics/accounts/dataLakeStoreAccounts",
            "apiVersion": "2016-11-01",
            "name": "[concat(parameters('accounts_iotdla753689d9_name'), '/iotdls753689d9')]",
            "dependsOn": [
                "[resourceId('Microsoft.DataLakeAnalytics/accounts', parameters('accounts_iotdla753689d9_name'))]"
            ],
            "properties": {}
        },
        {
            "type": "Microsoft.StreamAnalytics/streamingjobs/inputs",
            "apiVersion": "2016-03-01",
            "name": "[concat(parameters('streamingjobs_iot_asa_753689D9_name'), '/iotstream')]",
            "dependsOn": [
                "[resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('streamingjobs_iot_asa_753689D9_name'))]"
            ],
            "properties": {
                "type": "Stream",
                "datasource": {
                    "type": "Microsoft.Devices/IotHubs",
                    "properties": {
                        "iotHubNamespace": "iot-hub-753689D9",
                        "sharedAccessPolicyName": "iothubowner",
                        "endpoint": "messages/events",
                        "consumerGroupName": "$Default"
                    }
                },
                "compression": {
                    "type": "None"
                },
                "serialization": {
                    "type": "Json",
                    "properties": {
                        "encoding": "UTF8"
                    }
                },
                "etag": "2214c01c-ca8a-43f4-930b-34155d3ba031"
            }
        },
        {
            "type": "Microsoft.StreamAnalytics/streamingjobs/outputs",
            "apiVersion": "2016-03-01",
            "name": "[concat(parameters('streamingjobs_iot_asa_753689D9_name'), '/dlsoutput')]",
            "dependsOn": [
                "[resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('streamingjobs_iot_asa_753689D9_name'))]"
            ],
            "properties": {
                "datasource": {
                    "type": "Microsoft.DataLake/Accounts",
                    "properties": {
                        "filePathPrefix": "/telemetry/{date}",
                        "accountName": "iotdls753689d9",
                        "tenantId": "6ebcd4f1-71aa-4cdb-82fb-b0a6043aa0c0",
                        "dateFormat": "yyyy/MM/dd",
                        "timeFormat": "HH",
                        "authenticationMode": "UserToken",
                        "refreshToken": null,
                        "accessToken": null,
                        "tokenUserPrincipalName": "bin.c.sun@avanade.com",
                        "tokenUserDisplayName": "bin.c.sun@avanade.com Sun"
                    }
                },
                "serialization": {
                    "type": "Json",
                    "properties": {
                        "encoding": "UTF8",
                        "format": "Array"
                    }
                }
            }
        },
        {
            "type": "Microsoft.StreamAnalytics/streamingjobs/outputs",
            "apiVersion": "2016-03-01",
            "name": "[concat(parameters('streamingjobs_iot_asa_753689D9_name'), '/funcoutput')]",
            "dependsOn": [
                "[resourceId('Microsoft.StreamAnalytics/streamingjobs', parameters('streamingjobs_iot_asa_753689D9_name'))]"
            ],
            "properties": {
                "datasource": {
                    "type": "Microsoft.AzureFunction",
                    "properties": {
                        "functionAppName": "iot-func-753689D9",
                        "functionName": "WindSpeedHttpTrigger",
                        "apiKey": null
                    }
                }
            }
        },
        {
            "type": "Microsoft.Web/sites",
            "apiVersion": "2016-08-01",
            "name": "[parameters('sites_iot_func_753689D9_name')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_CentralUSPlan_name'))]"
            ],
            "kind": "functionapp",
            "properties": {
                "enabled": true,
                "hostNameSslStates": [
                    {
                        "name": "iot-func-753689d9.azurewebsites.net",
                        "sslState": "Disabled",
                        "hostType": "Standard"
                    },
                    {
                        "name": "iot-func-753689d9.scm.azurewebsites.net",
                        "sslState": "Disabled",
                        "hostType": "Repository"
                    }
                ],
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_CentralUSPlan_name'))]",
                "reserved": false,
                "scmSiteAlsoStopped": false,
                "clientAffinityEnabled": false,
                "clientCertEnabled": false,
                "hostNamesDisabled": false,
                "containerSize": 1536,
                "dailyMemoryTimeQuota": 0,
                "httpsOnly": false
            }
        },
        {
            "type": "Microsoft.Web/sites/config",
            "apiVersion": "2016-08-01",
            "name": "[concat(parameters('sites_iot_func_753689D9_name'), '/web')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_iot_func_753689D9_name'))]"
            ],
            "properties": {
                "numberOfWorkers": 1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php"
                ],
                "netFrameworkVersion": "v4.0",
                "phpVersion": "5.6",
                "pythonVersion": "",
                "nodeVersion": "",
                "linuxFxVersion": "",
                "requestTracingEnabled": false,
                "remoteDebuggingEnabled": false,
                "httpLoggingEnabled": false,
                "logsDirectorySizeLimit": 35,
                "detailedErrorLoggingEnabled": false,
                "publishingUsername": "$iot-func-753689D9",
                "scmType": "None",
                "use32BitWorkerProcess": true,
                "webSocketsEnabled": false,
                "alwaysOn": false,
                "appCommandLine": "",
                "managedPipelineMode": "Integrated",
                "virtualApplications": [
                    {
                        "virtualPath": "/",
                        "physicalPath": "site\\wwwroot",
                        "preloadEnabled": false,
                        "virtualDirectories": null
                    }
                ],
                "winAuthAdminState": 0,
                "winAuthTenantState": 0,
                "customAppPoolIdentityAdminState": false,
                "customAppPoolIdentityTenantState": false,
                "loadBalancing": "LeastRequests",
                "routingRules": [],
                "experiments": {
                    "rampUpRules": []
                },
                "autoHealEnabled": false,
                "vnetName": "",
                "siteAuthEnabled": false,
                "siteAuthSettings": {
                    "enabled": null,
                    "unauthenticatedClientAction": null,
                    "tokenStoreEnabled": null,
                    "allowedExternalRedirectUrls": null,
                    "defaultProvider": null,
                    "clientId": null,
                    "clientSecret": null,
                    "clientSecretCertificateThumbprint": null,
                    "issuer": null,
                    "allowedAudiences": null,
                    "additionalLoginParams": null,
                    "isAadAutoProvisioned": false,
                    "googleClientId": null,
                    "googleClientSecret": null,
                    "googleOAuthScopes": null,
                    "facebookAppId": null,
                    "facebookAppSecret": null,
                    "facebookOAuthScopes": null,
                    "twitterConsumerKey": null,
                    "twitterConsumerSecret": null,
                    "microsoftAccountClientId": null,
                    "microsoftAccountClientSecret": null,
                    "microsoftAccountOAuthScopes": null
                },
                "cors": {
                    "allowedOrigins": [
                        "https://functions.azure.com",
                        "https://functions-staging.azure.com",
                        "https://functions-next.azure.com"
                    ],
                    "supportCredentials": false
                },
                "localMySqlEnabled": false,
                "http20Enabled": false,
                "minTlsVersion": "1.2",
                "ftpsState": "AllAllowed",
                "reservedInstanceCount": 0
            }
        },
        {
            "type": "Microsoft.Web/sites/deployments",
            "apiVersion": "2016-08-01",
            "name": "[concat(parameters('sites_iot_func_753689D9_name'), '/58ca687d6dfc4d75acf7b8767c97244e')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_iot_func_753689D9_name'))]"
            ],
            "properties": {
                "id": "58ca687d6dfc4d75acf7b8767c97244e",
                "status": 4,
                "author_email": "N/A",
                "author": "N/A",
                "deployer": "Push-Deployer",
                "message": "Created via a push deployment",
                "start_time": "2019-04-23T22:58:28.009885Z",
                "end_time": "2019-04-23T22:58:40.6255749Z",
                "active": true
            }
        },
        {
            "type": "Microsoft.Web/sites/hostNameBindings",
            "apiVersion": "2016-08-01",
            "name": "[concat(parameters('sites_iot_func_753689D9_name'), '/', parameters('sites_iot_func_753689D9_name'), '.azurewebsites.net')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_iot_func_753689D9_name'))]"
            ],
            "properties": {
                "siteName": "iot-func-753689D9",
                "hostNameType": "Verified"
            }
        }
    ]
}

产生错误:

  

New-AzureRmResourceGroupDeployment:7:44:24 AM-错误:   Code = InvalidTemplate;消息=部署模板验证失败:   '为模板参数提供的值   第11行的'accounts_iotdla753689d9_dataLakeStoreAccounts'和   列“ 58”无效。”。在   C:\ Users \ Dennis \ Desktop \ WeatherStation-753689D9 \ deploy.ps1:104 char:5   + New-AzureRmResourceGroupDeployment -ResourceGroupName $ resourceGr ...   + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~       + CategoryInfo:未指定:(:) [New-AzureRmResourceGroupDeployment],异常       + FullyQualifiedErrorId:Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceG   roupDeploymentCmdlet

第11行和第58列是指deploy.ps文件还是其他文件?谢谢。

0 个答案:

没有答案