DSC error for post deployment SQL configuration - azure

I am deploying SQL server 2016 with ARM to Azure. Trying to implement post deployment configuration with DSC module.
DSC config:
xSQLServerSetup 'InstallDefaultInstance'
{
InstanceName = 'MSSQLSERVER'
SQLCollation = 'SQL_Latin1_General_CP1_CI_AS'
SQLSysAdminAccounts = $SqlInstallCredential
SourcePath = 'C:\SQLServerFull\'
DependsOn = '[WindowsFeature]NetFramework35','[WindowsFeature]NetFramework45', '[xDisk]TVolume'
}
And get the following:
"error": {
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"VMExtensionProvisioningError\",\r\n \"message\": \"VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: \\\"DSC Configuration 'Main' completed with error(s). Following are the first few: The network name cannot be found. Cannot bind argument to parameter 'Path' because it is an empty string. Cannot bind argument to parameter 'Path' because it is an empty string.\\\".\"\r\n }\r\n ]\r\n }\r\n}"
Any suggestions?

Related

Azure Storage Accounts bicep deployment fails for sku Standard_LRS

I have the following bicep file for Azure Blobs Storage on the Standard_LRS
resource storageAccount 'Microsoft.Storage/storageAccounts#2022-05-01' = {
name: 'ifmsstorageaccount'
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'BlockBlobStorage'
properties: {
accessTier: 'Hot'
}
}
when deploying to azure I get the following error:
ERROR: ***"status":"Failed","error":***"code":"DeploymentFailed","message":"At
least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for
usage details.","details":[***"code":"Conflict","message":"***\r\n
\"status\": \"Failed\",\r\n \"error\": ***\r\n \"code\":
\"ResourceDeploymentFailure\",\r\n \"message\": \"The resource
operation completed with terminal provisioning state 'Failed'.\",\r\n
\"details\": [\r\n ***\r\n \"code\": \"DeploymentFailed
\",\r\n \"message\": \"At least one resource deployment operation
failed. Please list deployment operations for details. Please see
https://aka.ms/DeployOperations for usage details.\",\r\n
\"details\": [\r\n ***\r\n \"code\": \"BadRequest
\",\r\n \"message\": \"***\\r\\n \\\"error\\\": ***\\r\\n
\\\"code\\\": \\\"InvalidParameter\\\",\\r\\n \\\"message\\\": \\\"Pricing tier doesn't match the subscription's billing model. Read
http://aka.ms/PricingTierWarning for more details. Operation Id:
'ccfd950570ed8ac1dd3214b811d46933'\\\"\\r\\n ***\\r\\n***\"\r\n
***\r\n ]\r\n ***\r\n ]\r\n ***\r\n***"***,***"code":"Conflict","message":"***\r\n \"status\":
\"Failed\",\r\n \"error\": ***\r\n \"code\":
\"ResourceDeploymentFailure\",\r\n \"message\": \"The resource
operation completed with terminal provisioning state 'Failed'.\",\r\n
\"details\": [\r\n ***\r\n \"code\": \"DeploymentFailed
\",\r\n \"message\": \"At least one resource deployment operation
failed. Please list deployment operations for details. Please see
https://aka.ms/DeployOperations for usage details.\",\r\n
\"details\": [\r\n ***\r\n \"code\": \"BadRequest
\",\r\n \"message\": \"***\\r\\n \\\"error\\\": ***\\r\\n
\\\"code\\\": \\\"ParameterOutOfRange\\\",\\r\\n \\\"message\\\":
\\\"The value of the 'Sku.Name' should be in: [Standard_B1ms,
Standard_B1s, Standard_B2s, Standard_B4ms, Standard_B8ms,
Standard_D16s_v3, Standard_D2s_v3, Standard_D32s_v3, Standard_D4s_v3,
Standard_D64s_v3, Standard_D8s_v3, Standard_E16s_v3, Standard_E2s_v3,
Standard_E32s_v3, Standard_E4s_v3, Standard_E64s_v3, Standard_E8s_v3,
Standard_M128ms, Standard_M128s, Standard_M64ms, Standard_M64s,
Standard_E48s_v3, Standard_D2ds_v4, Standard_D4ds_v4, Standard_D8ds_v4,
Standard_D16ds_v4, Standard_D32ds_v4, Standard_D48ds_v4,
Standard_D64ds_v4, Standard_E2ds_v4, Standard_E4ds_v4, Standard_E8ds_v4,
Standard_E16ds_v4, Standard_E32ds_v4, Standard_E48ds_v4,
Standard_E64ds_v4, Standard_D48s_v3, Standard_E20ds_v4, Standard_M8ms,
Standard_M16ms, Standard_M32ts, Standard_M32ls, Standard_M32ms,
Standard_M64ls, Standard_M64, Standard_M64m, Standard_M128, Standard_M128m, Standard_B12ms, Standard_B16ms, Standard_B20ms,
Standard_D2ads_v5, Standard_D4ads_v5, Standard_D8ads_v5,
Standard_D16ads_v5, Standard_D32ads_v5, Standard_D48ads_v5,
Standard_D64ads_v5, Standard_D96ads_v5, Standard_E2ads_v5,
Standard_E4ads_v5, Standard_E16ads_v5, Standard_E20ads_v5,
Standard_E32ads_v5, Standard_E48ads_v5, Standard_E64ads_v5,
Standard_E96ads_v5, Standard_D2_v5, Standard_D4_v5, Standard_D8_v5,
Standard_D16_v5, Standard_D32_v5, Standard_D48_v5, Standard_D64_v5,
Standard_D96_v5, Standard_D2s_v5, Standard_D4s_v5, Standard_D8s_v5,
Standard_D16s_v5, Standard_D32s_v5, Standard_D48s_v5, Standard_D64s_v5,
Standard_D96s_v5, Standard_D2ds_v5, Standard_D4ds_v5, Standard_D8ds_v5,
Standard_D16ds_v5, Standard_D32ds_v5, Standard_D48ds_v5,
Standard_D64ds_v5, Standard_D96ds_v5, Standard_E2ds_v5,
Standard_E4ds_v5, Standard_E8ds_v5, Standard_E16ds_v5,
Standard_E20ds_v5, Standard_E32ds_v5, Standard_E48ds_v5,
Standard_E64ds_v5, Standard_E96ds_v5, Standard_E104ids_v5,
Standard_E2bds_v5, Standard_E4bds_v5, Standard_E8bds_v5,
Standard_E16bds_v5, Standard_E32bds_v5, Standard_E48bds_v5,
Standard_E64bds_v5]. Verify that the specified parameter value is
correct.\\\"\\r\\n ***\\r\\n***\"\r\n ***\r\n ]\r\n
***\r\n ]\r\n ***\r\n***"***,***"code":"Conflict","message":"***\r\n
\"status\": \"Failed\",\r\n \"error\": ***\r\n \"code\":
\"ResourceDeploymentFailure\",\r\n \"message\": \"The resource
operation completed with terminal provisioning state 'Failed'.\",\r\n
\"details\": [\r\n ***\r\n \"code\": \"DeploymentFailed
\",\r\n \"message\": \"At least one resource deployment operation
failed. Please list deployment operations for details. Please see
https://aka.ms/DeployOperations for usage details.\",\r\n
\"details\": [\r\n ***\r\n \"code\": \"BadRequest
\",\r\n \"message\": \"***\\r\\n \\\"error\\\": ***\\r\\n
\\\"code\\\": \\\"InvalidValuesForRequestParameters\\\",\\r\\n
\\\"message\\\": \\\"Values for request parameters are invalid: kind,
sku. For more information, see - https://aka.ms/storageaccounttypes\\\"
\\r\\n ***\\r\\n***\"\r\n ***\r\n ]\r\n ***\r\n
]\r\n ***\r\n***"***]***
and I don't know how to tell which of these are Standard_LRS
The BlockBlobStorage kind is part of the Premium SKU.
In order for the storage account to be deployed, you would need to slightly amend your configuration so that the SKU name matches the chosen kind configuration:
resource storage_account 'Microsoft.Storage/storageAccounts#2022-09-01' = {
name: 'ifmsstorageaccount'
location: location
sku: {
name: 'Premium_LRS'
}
kind: 'BlockBlobStorage'
}
This should allow you to deploy the storage account. The displayed VM SKUs are strange but I assume that you also have some further configurations in your bicep file that are the cause for that particular error.
Hope this helps!
I tried in my environment and got below results:
According to MS-DOCS, location should be string in your code like East US or West US.
Main.bicep:
resource storageAccount 'Microsoft.Storage/storageAccounts#2022-05-01'= {
name: 'venkat9874'
location: 'East US'
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
accessTier: 'Hot'
}
}
The above Bicep file is deployed with using PowerShell.
Commands:
New-AzResourceGroupDeployment -TemplateFile Main.bicep -ResourceGroupName <your resource grp>
Console:
Portal:

Error The parameter LinuxFxVersion has an invalid value when deploying my azure function resource

I am attempting to deploy .NET Framework application with Azure function, i am working off an existing ARM json template which i converted to .bicep file. One of the resources is the below
resource resourceName_resource 'Microsoft.Web/sites#2021-02-01' = {
name: resourceName
location: resourceLocation
identity: {
type: 'SystemAssigned'
}
tags: {
'hidden-related:${appServicePlan_ResourceId}': 'empty'
}
kind: 'functionapp'
properties: {
httpsOnly: true
reserved: false
serverFarmId: appServicePlan_ResourceId
siteConfig: {
alwaysOn: true
linuxFxVersion: 'DOTNETCORE|6.0'
}
}
dependsOn: [
appServicePlan_name
storage_name
]
}
However when i run the deployment i get the below error, now i am assuming the error is caused by the above configuration as thats the only resource with LinuxFxVersion. How do i correct this error ?
{
"status":"Failed",
"error":{
"code":"DeploymentFailed",
"message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details":[
{
"code":"BadRequest",
"message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"The parameter LinuxFxVersion has an invalid value.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"The parameter LinuxFxVersion has an invalid value.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"ExtendedCode\": \"01007\",\r\n \"MessageTemplate\": \"The parameter {0} has an invalid value.\",\r\n \"Parameters\": [\r\n \"LinuxFxVersion\"\r\n ],\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"The parameter LinuxFxVersion has an invalid value.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"
}
]
}
}
Double check the bicep for deploying the Microsoft.Web/serverfarms resource. I recall a similar error because I had left out the property setting reserved: true. Once I added that setting, then the deployment succeeded. If you already created the app service plan, you'll need to remove it and redeploy in order for the change to be accepted.
I ran the following and it worked.
param location string = 'East US'
resource hostingPlan 'Microsoft.Web/serverfarms#2021-01-15' = {
name: 'apphostingplanname'
location: location
properties: {
reserved: true
}
sku: {
tier: 'Standard'
name: 'S1'
}
kind: 'linux'
}
resource resourceName_resource 'Microsoft.Web/sites#2021-02-01' = {
name: 'somewebapp72478340'
location: location
identity: {
type: 'SystemAssigned'
}
tags: {
'hidden-related:${hostingPlan.id}': 'empty'
}
kind: 'functionapp'
properties: {
httpsOnly: true
reserved: false
serverFarmId: hostingPlan.id
siteConfig: {
alwaysOn: true
linuxFxVersion: 'DOTNETCORE|6.0'
}
}
}
Result:

Azure Terraform Policy Error "Missing subscription -The request did not have a subscription or a valid tenant level resource provider"

I'm trying to apply the Azurerm_policy_assignment using Terraform - i'm unable to apply the policy assignment, looks like an identity related issue:
policy.AssignmentsClient#Create: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="MissingSubscription" Message="The request did not have a subscription or a valid tenant level resource provider
The following is the code that I am trying to run:
resource "azurerm_policy_assignment" "policyassignment" {
name = "policy1assignment"
scope = var.policyscope
policy_definition_id = "/providers/Microsoft.Authorization/policySetDefinitions/jfda8af9-198f-asa3-1234-dsa8dfs090fsd"
description = "TestPolicy"
display_name = "TestPolicy"
location = var.location
identity {
type = "SystemAssigned"
}
}

Terraform - Provision VM Extensions with Parameters

I'm trying to provision two Azure Virtual Machine Extensions, that have parameters associated to them:
Microsoft Antimalware
Site24x7 Agent for Windows Server Monitoring
I could not find much documentation, but I tried to extract the data from the azure portal under Automation script to see how it was setup in JSON template.
resource "azurerm_virtual_machine_extension" "test1" {
name = "IaaSAntimalware"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
virtual_machine_name = "${azurerm_virtual_machine.testapp.name}"
publisher = "Microsoft.Azure.Security"
type = "IaaSAntimalware"
type_handler_version = "1.5.5.1"
auto_upgrade_minor_version = "true"
settings = <<SETTINGS
{
"AntimalwareEnabled": true,
"RealtimeProtectionEnabled": "true",
"ScheduledScanSettings": {
"isEnabled": "true",
"day": "1",
"time": "120",
"scanType": "Quick"
},
"Exclusions": {
"Extensions": "",
"Paths": "",
"Processes": ""
}
}
SETTINGS
tags {
environment = "${var.tag_env}" }
}
Azure Portal Configuration for Antimalware Extension
azurerm_virtual_machine_extension.test1: 1 error(s) occurred:`
azurerm_virtual_machine_extension.test1: compute.VirtualMachineExtensionsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidParameter" Message="The value of parameter typeHandlerVersion is invalid."
Does anyone know the proper syntax?
If you look at this line in the anti-malware-extension-windows-vm sample of azure-quickstart-templates: "typeHandlerVersion": "1.1", you see that you are passing the wrong value for the version.

Moving resources failed because resource group has active deployments

When I try to change a website's resource group in Azure Powershell, I get the following error:
"Error": {
"Code": "MultipleErrorsOccurred",
"Message": "Multiple error occurred: Conflict,Conflict. Please see details.",
"Target": null,
"Details": [
{
"Code": "DeploymentActive",
"Message": "Moving resources failed because resource group 'rg1' has active deployments.",
"Target": null,
"Details": null
},
{
"Code": "DeploymentActive",
"Message": "Moving resources failed because resource group 'rg1' has active deployments.",
"Target": null,
"Details": null
}
}
I use the following commands:
$webapp = Get-AzureResource -ResourceGroupName "rg1" -ResourceName resourceName -ResourceType Microsoft.Web/sites
Move-AzureResource -DestinationResourceGroupName "rg2" -ResourceId $webapp.ResourceId
One solution is to delete and recreate the website but is there any other way that we can sort this problem out without deleting anything?
Move-AzureResource is obsolete now. Try using Move-AzureRmResource.
For the error, you will have to wait till an ongoing deployment in rg1 is complete.
You could retry once the deployment is complete.
Cheers!

Resources