Azure Resource Manager (ARM) Import Databases (Bacpac) Error (Closed) - azure

I am using ARM template to perform Import Azure SQL databases from bacpac files storing on my storage account.
However I am getting unexpected Bad Request error from Azure.
The same ARM template has been working fine just a few weeks ago.
When I try to do the Import Databases in the new Azure portal manually, I am also getting error from Azure, but they didn't specify the error detail.
I have tried for three different locations: Southeast Asia, North Europe and Central US but all have failed.
Below is my ARM template portion for database server and database import.
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2014-04-01-preview",
"properties": {
"administratorLogin": "[parameters('dbLogin')]",
"administratorLoginPassword": "[parameters('dbPassword')]",
"version": "12.0"
},
"name": "[parameters('sqlServerName')]",
"location": "[resourceGroup().location]",
"resources": [
{
"type": "firewallrules",
"apiVersion": "2014-04-01-preview",
"properties": {
"endIpAddress": "0.0.0.0",
"startIpAddress": "0.0.0.0"
},
"name": "AllowAllWindowsAzureIps",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
]
},
{
"type": "databases",
"apiVersion": "2014-04-01-preview",
"properties": {
"edition": "[parameters('databaseEdition')]",
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": "[parameters('maxDatabaseSize')]",
"requestedServiceObjectiveId": "[parameters('dbServiceObjectiveLevel')]"
},
"name": "[parameters('webDatabaseName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
],
"resources": [
{
"type": "extensions",
"apiVersion": "2014-04-01-preview",
"properties": {
"operationMode": "Import",
"storageKey": "[parameters('bacpacStorageKey')]",
"storageKeyType": "Primary",
"administratorLogin": "[parameters('dbLogin')]",
"administratorLoginPassword": "[parameters('dbPassword')]",
"storageUri": "[parameters('webBacpacUrl')]"
},
"name": "Import",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('sqlServerName'), parameters('webDatabaseName'))]"
]
}
]
},
{
"type": "databases",
"apiVersion": "2014-04-01-preview",
"properties": {
"edition": "[parameters('databaseEdition')]",
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": "[parameters('maxDatabaseSize')]",
"requestedServiceObjectiveId": "[parameters('dbServiceObjectiveLevel')]"
},
"name": "[parameters('coreDatbaseName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
],
"resources": [
{
"type": "extensions",
"apiVersion": "2014-04-01-preview",
"properties": {
"operationMode": "Import",
"storageKey": "[parameters('bacpacStorageKey')]",
"storageKeyType": "Primary",
"administratorLogin": "[parameters('dbLogin')]",
"administratorLoginPassword": "[parameters('dbPassword')]",
"storageUri": "[parameters('coreBacpacUrl')]"
},
"name": "Import",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('sqlServerName'), parameters('coreDatbaseName'))]"
]
}
]
},
{
"type": "databases",
"apiVersion": "2014-04-01-preview",
"properties": {
"edition": "[parameters('databaseEdition')]",
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": "[parameters('maxDatabaseSize')]",
"requestedServiceObjectiveId": "[parameters('dbServiceObjectiveLevel')]"
},
"name": "[parameters('mastrerDatabaseName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
],
"resources": [
{
"type": "extensions",
"apiVersion": "2014-04-01-preview",
"properties": {
"operationMode": "Import",
"storageKey": "[parameters('bacpacStorageKey')]",
"storageKeyType": "Primary",
"administratorLogin": "[parameters('dbLogin')]",
"administratorLoginPassword": "[parameters('dbPassword')]",
"storageUri": "[parameters('masterBacpacUrl')]"
},
"name": "Import",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('sqlServerName'), parameters('mastrerDatabaseName'))]"
]
}
]
}
]
}
The error from Azure portal for my ARM deployment:
Any help or advice is appreciated!
Note: I have suspected this could be due to platform issue but there is no issue reported for the past few days on the locations I tried based on the
Azure status history

Verified with Microsoft Azure Support and they confirmed this is a platform issue.
Update:
The issue is verified resolved after Microsoft resolved the platform issue related to Import Database.

Related

Configure diagnostic setting for Azure sql database via ARM Template

I am trying to set diagnostic settings for my Azure sql database via ARM template, However the diagnostic part (nested under database resource) is failing because the type 'providers/diagnosticsetting' is invalid.
Error:
New-AzResourceGroupDeployment : 4:56:26 AM - Resource providers/diagnosticSettings 'monitor' failed with message '{
"error": {
"code": "InvalidResourceNamespace",
"message": "The resource namespace 'providers' is invalid."
}
}'
ARM Template snippet:
"resources": [
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2020-02-02-preview",
"name": "[parameters('serverName')]",
"location": "[parameters('location')]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"administratorLogin": "[parameters('administratorLogin')]",
"administratorLoginPassword": "[parameters('administratorLoginPassword')]",
"version": "12.0"
},
"resources": [
{
"type": "databases",
"apiVersion": "2020-02-02-preview",
"name": "[parameters('sqlDBName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard",
"tier": "Standard"
},
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', concat(parameters('serverName')))]"
],
"resources": [
{
"type": "transparentDataEncryption",
"apiVersion": "2017-03-01-preview",
"name": "current",
"dependsOn": [
"[parameters('sqlDBName')]"
],
"properties": {
"status": "Enabled"
}
},
{
"type": "providers/diagnosticSettings",
"apiVersion": "2017-05-01-preview",
"name": "monitor",
"dependsOn": [
"[parameters('sqlDBName')]"
],
"properties": {
"workspaceId": "[parameters('logAnalyticsWorkspaceIdForGlobalDiagnosticSetting')]",
"logs": [
],
"metrics": [
]
}
},
{
"type": "vulnerabilityAssessments",
"apiVersion": "2020-02-02-preview",
"name": "default",
"dependsOn": [
"[parameters('sqlDBName')]"
],
"properties": {
"storageContainerPath": "[parameters('storageContainerPathForVulnerabilityAssesment')]",
"storageAccountAccessKey": "[parameters('storageAccountAccessKeyForVulnerabilityAssesment')]",
"recurringScans": {
"isEnabled": true,
"emailSubscriptionAdmins": false,
"emails": []
}
}
}
]
}
]
},
{
"type": "Microsoft.Sql/servers/firewallRules",
"apiVersion": "2020-02-02-preview",
"name": "[concat(parameters('serverName'), '/AllowAzureIPs')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
],
"properties": {
"endIpAddress": "0.0.0.0",
"startIpAddress": "0.0.0.0"
}
},
{
"type": "Microsoft.Sql/servers/administrators",
"apiVersion": "2020-08-01-preview",
"name": "[concat(parameters('serverName'), '/ActiveDirectory')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
],
"properties": {
"administratorType": "ActiveDirectory",
"login": "[parameters('azureActiveDirectoryAdminLogin')]",
"sid": "[parameters('azureActiveDirectoryAdminSid')]",
"tenantId": "[parameters('azureActiveDirectoryAdminTenantId')]"
}
},
{
"type": "Microsoft.Sql/servers/securityAlertPolicies",
"apiVersion": "2020-08-01-preview",
"name": "[concat(parameters('serverName'), '/Default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
],
"properties": {
"state": "Enabled",
"emailAccountAdmins": false
}
},
{
"type": "Microsoft.Sql/servers/auditingSettings",
"apiVersion": "2020-08-01-preview",
"name": "[concat(parameters('serverName'), '/Default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
],
"properties": {
"isDevopsAuditEnabled": false,
"retentionDays": 0,
"auditActionsAndGroups": [
"SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP",
"FAILED_DATABASE_AUTHENTICATION_GROUP",
"BATCH_COMPLETED_GROUP"
],
"isStorageSecondaryKeyInUse": false,
"isAzureMonitorTargetEnabled": false,
"state": "Enabled",
"storageEndpoint": "[reference(resourceId(parameters('centralMonitoringResourceGroup'), 'Microsoft.Storage/storageAccounts', parameters('centralMonitoringStorageAccountName')), '2019-06-01').PrimaryEndpoints.Blob]",
"storageAccountAccessKey": "[parameters('centralMonitoringStorageAccountAccessKey')]",
"storageAccountSubscriptionId": "[parameters('centralMonitoringStorageAccountSubscriptionId')]"
}
},
{
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"apiVersion": "2020-08-01-preview",
"name": "[concat(parameters('serverName'), '/Default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]",
"[concat('Microsoft.Sql/servers/', parameters('serverName'), '/securityAlertPolicies/Default')]"
],
"properties": {
"storageContainerPath": "[parameters('storageContainerPathForVulnerabilityAssesment')]",
"storageAccountAccessKey": "[parameters('storageAccountAccessKeyForVulnerabilityAssesment')]",
"recurringScans": {
"isEnabled": true,
"emailSubscriptionAdmins": false,
"emails": []
}
}
},
{
"type": "Microsoft.Sql/servers/encryptionProtector",
"apiVersion": "2020-08-01-preview",
"name": "[concat(parameters('serverName'), '/current')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
],
"kind": "servicemanaged",
"properties": {
"serverKeyName": "ServiceManaged",
"serverKeyType": "ServiceManaged",
"autoRotationEnabled": false
}
},
{
"type": "Microsoft.Sql/servers/connectionPolicies",
"apiVersion": "2014-04-01",
"name": "[concat(parameters('serverName'), '/ConnectionPolicies')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('serverName'))]"
],
"properties": {
"connectionType": "[parameters('connectionType')]"
}
}
]

Azure app service slot different value app setting

I have a webapp with a slot. Both should have the app setting name DISABLE_CRON. The webapp (production slot) should have this setting set to false and the slot should have the setting set to true. I would like to do this with ARM-template. The webapp have many appsettings such as database name, database login username and password etc. I want all of those settings to be in a variable so I don't have to write them one time for the webapp and one time for the slot. Basically I just want to change the value to true on the slot and keep all other settings the same.
"variables": {
"appName": "[concat(parameters('applicationName'),'-',parameters('environment'),'-app')]",
"hostingPlanName": "[concat(parameters('applicationName'),'-',parameters('environment'),'-plan')]",
"dbserverName": "[concat('onlinecampaignsites-',parameters('environment'),'-dbs-01')]",
"connectionString": "[concat('Database=', parameters('applicationName'), ';Data Source=', concat('onlinecampaignsites-',parameters('environment'),'-dbs-01'),'.mysql.database.azure.com;User Id=',parameters('administratorLogin'),'#',concat('onlinecampaignsites-',parameters('environment'),'-dbs-01'),';Password=',parameters('administratorLoginPassword'))]",
"appInsightsName": "[concat(parameters('applicationName'),'-',parameters('environment'),'-appIn')]",
"databaseName": "[parameters('applicationName')]",
"storageName": "[concat(parameters('applicationName'),parameters('environment'),'stg')]",
"serverFarmResourceGroup": "[resourceGroup().name]",
"subscriptionId": "[subscription().subscriptionId]",
"containerName01": "[concat(parameters('applicationName'),'-',parameters('environment'),'-uploads')]",
"staging": "staging",
"appsettings": {
"DISABLE_CRON": "false",
"HEJSAN": "Den vann den"
}
},
"resources": [
{
"name": "[variables('appname')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2018-02-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]"
],
"properties": {
"siteConfig": {
"appSettings": [
{
"name": "DISABLE_CRON",
"value": "true"
}
]
},
"hostNameSslStates":"[concat('{\"name\": \"',parameters('customDomain'),'\", \"sslState\": \"Disabled\", \"virtualIP\": null, \"thumbprint\": null, \"toUpdate\": null,\"hostType\": \"Standard\"}')]",
"serverFarmId": "[concat('/subscriptions/', variables('subscriptionId'),'/resourcegroups/', variables('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', variables('hostingPlanName'))]",
"hostingEnvironment": "",
"httpsOnly": true
},
"resources": [
{
"apiVersion": "2018-02-01",
"name": "slotconfignames",
"type": "config",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('appName'))]"
],
"properties": {
"appSettingNames": [ "DISABLE_CRON" ]
}
},
{
"apiVersion": "2018-02-01",
"type": "config",
"name": "appsettings",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('appName'))]"
],
"properties": "[variables('appsettings')]"
}
]
},
{
"apiVersion": "2018-02-01",
"type": "Microsoft.Web/sites/slots",
"name": "[concat(variables('appName'), '/', variables('staging'))]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('appName'))]",
"[concat('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]"
],
"properties": {},
"resources": [
{
"apiVersion": "2018-02-01",
"type": "config",
"name": "appsettings",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/slots', variables('appName'), variables('staging'))]"
],
"properties": "[variables('appsettings')]"
}
]
},
In the ARM-template example there are two appsettings. It does not work to set the DISABLE_CRON to true, I just wanted to show that with this example.

How to add multiple client IP addresses at time in Azure SQL Server using Azure ARM Templates?

Currently I am working on to deploy the Azure SQL Database by adding multiple IP addresses under Firewall rules using Azure ARM templates.
This is the code for adding one IP address under Firewall settings of Azure SQL Server.
{
"name": "AllowAllMicrosoftAzureIps",
"type": "firewallrules",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"properties": {
"startIpAddress": "[parameters('startIpAddress')]",
"endIpAddress": "[parameters('endIpAddress')]"
},
"dependsOn": [
"[variables('sqlServerName')]"
]
},
But I want to add the multiple IP addresses at a time under Firewall settings of Azure SQL Database using Azure ARM templates.
I haven't tested it, but I believe it would look something like this. Use the copy iterator and supply an array of start and end IP addresses.
"parameters": {
"firewallIpAddresses": {
"type": "object",
"defaultValue": [
{ "start": "1.1.1.0", "end": "1.1.1.10","clientName": "Client1" },
{ "start": "1.2.3.4", "end": "1.2.3.16","clientName": "Client2" },
{ "start": "1.2.0.1", "end": "1.2.0.20","clientName": "Client3" }
]
}
},
"resources": [
{
"name": "[concat(variables('sqlServerName'), '/', parameters('firewallIpAddresses')[copyIndex()].clientName)]",
"type": "Microsoft.Sql/servers/firewallrules",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"properties": {
"startIpAddress": "[parameters('firewallIpAddresses')[copyIndex('firewallrulecopy')].start]",
"endIpAddress": "[parameters('firewallIpAddresses')[copyIndex('firewallrulecopy')].end]"
},
"dependsOn": [
"[variables('sqlServerName')]"
],
"copy": {
"name": "firewallrulecopy",
"count": "[length(parameters('firewallIpAddresses'))]"
}
}
]
"name": "nba-instance-one",
"type": "Microsoft.Sql/servers",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "sql-server-instance"
},
"properties": {
"administratorLogin": "admin",
"administratorLoginPassword": "password"
},
"resources": [
{
"type": "firewallRules",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"name": "LaptopIp",
"properties": {
"startIpAddress": "39.188.172.29",
"endIpAddress": "39.188.172.29"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', 'sql-server-instance')]"
]
},
{
"type": "firewallRules",
"apiVersion": "2014-04-01",
"location": "[resourceGroup().location]",
"name": "OtherIP",
"properties": {
"startIpAddress": "38.171.192.48",
"endIpAddress": "38.171.192.48"
},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', 'sql-server-instance')]"
]
}
If it's only a few IP addresses you could add more fire wall rules for each IP address.

How do I automatically install New Relic extension using Azure ARM Template?

I am using a azure arm template to create a web app in azure. Now I need to install New Relic Extension in the webapps which will be created using this template. So I was unable to find specific json format. Please help me out!
Please have a try to add the json code snipped in the ARM template.
"resources": [
{
"apiVersion": "2015-08-01",
"name": "NewRelic.Azure.WebSites",
"type": "siteextensions",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]"
],
"properties": {
}
}
],
I created a demo for it. The following is my detail steps. About the name of the extension please refer to the NewRelic.Azure.WebSites.
1. Create an Azure Resource Group Project.
2. Select the Web App project template
3. Just demo for web site extension so I delete the unnecessary resource
4. Add the snipped code in the ARM template
5. Deploy the website via Visual Studio
6. Check the Website in the Azure portal
The demo ARM template:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hostingPlanName": {
"type": "string",
"minLength": 1
},
"skuName": {
"type": "string",
"defaultValue": "F1",
"allowedValues": [
"F1",
"D1",
"B1",
"B2",
"B3",
"S1",
"S2",
"S3",
"P1",
"P2",
"P3",
"P4"
],
"metadata": {
"description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
}
},
"skuCapacity": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"metadata": {
"description": "Describes plan's instance count"
}
}
},
"variables": {
"webSiteName": "[concat('webSite', uniqueString(resourceGroup().id))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "HostingPlan"
},
"sku": {
"name": "[parameters('skuName')]",
"capacity": "[parameters('skuCapacity')]"
},
"properties": {
"name": "[parameters('hostingPlanName')]"
}
},
{
"apiVersion": "2015-08-01",
"name": "[variables('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"resources": [
{
"apiVersion": "2015-08-01",
"name": "NewRelic.Azure.WebSites",
"type": "siteextensions",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]"
],
"properties": {
}
}
],
"properties": {
"name": "[variables('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
}
}
]
}
"resources":[{
"apiVersion": "2018-11-01",
"name": "NewRelic.Azure.WebSites.Extension",
"type": "siteextensions",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('appServiceName'))]"
]
}]
The name is now NewRelic.Azure.Websites.Extension. You should give your App Service Name in the variable appServiceName in this case.

Deploy a node.js site using Azure Resource Manager

I'm struggling with a ARM deployment script for my node.js application. If I point to a repo with an MVC application it all works fine, but not using an node.js app.
Are there any specific settings for node.js sites?
Here is the resource part of my script:
{
"apiVersion": "2015-08-01",
"name": "[parameters('nodeName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('nodeName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('nodeName'))]"
],
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', concat(parameters('nodeName')))]"
],
"properties": {
"repoUrl": "https://github.com/microServiceBus/microservicebus.node.git",
"branch": "master",
"IsManualIntegration": true
}
}
],
"properties": {
"name": "[parameters('nodeName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('nodeName'))]",
"siteConfig": {
"appSettings": [
{
"Name": "hubUri",
"Value": "[parameters('hubUri')]"
},
{
"Name": "nodeName",
"Value": "[parameters('nodeName')]"
},
{
"Name": "organizationaId",
"Value": "[parameters('organizationaId')]"
}
]
}
}
}
The issue was that the name of the repo had a dot in it (microservicebus.node.git). I believe the bug is fixed or is going to be fixed soon.

Resources