Azure / arm-template-whatif

A repository to track issues related to what-if noise suppression
MIT License
87 stars 14 forks source link

What-if unable to check Log Analytics Workspace creation dependency in nested arm template json. #321

Open shagun-varshney opened 1 year ago

shagun-varshney commented 1 year ago

Describe the noise

Resource Type : Microsoft.OperationalInsights/workspaces

apiVersion : @2022-10-01

Client : Azure CLI, .Net API

Relevant ARM Template code (we only need the resource object for the above resourceType and apiVersion, but if it's easier you can include the entire template

{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "3523811625070929861" } }, "parameters": { "location": { "type": "string", "metadata": { "description": "Azure location where all the resources will be created." } } }, "variables": { "isVnetEnabled": true, "enableDDOS": false, "uniqueNameForResources": "[toLower(uniqueString(resourceGroup().id))]", "projectName": "[toLower(format('mci4m-{0}', variables('uniqueNameForResources')))]", "finalDnzZoneNameList": [] }, "resources": [ { "condition": "[variables('enableDDOS')]", "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "Deploy-DDOSProtection", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "itemName": { "value": "[format('ddos-{0}', variables('projectName'))]" }, "location": { "value": "[parameters('location')]" } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "2573435472221593821" } }, "parameters": { "location": { "type": "string" }, "itemName": { "type": "string" } }, "resources": [ { "type": "Microsoft.Network/ddosProtectionPlans", "apiVersion": "2022-07-01", "name": "[parameters('itemName')]", "location": "[parameters('location')]" } ], "outputs": { "id": { "type": "string", "value": "[resourceId('Microsoft.Network/ddosProtectionPlans', parameters('itemName'))]" } } } } }, { "condition": "[variables('isVnetEnabled')]", "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "Deploy-VirtualNetwork", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "itemName": { "value": "[format('vnet-{0}', variables('projectName'))]" }, "location": { "value": "[parameters('location')]" }, "ddosProtectionId": "[if(variables('enableDDOS'), createObject('value', reference(resourceId('Microsoft.Resources/deployments', 'Deploy-DDOSProtection'), '2020-10-01').outputs.id.value), createObject('value', ''))]" }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "11235442239663314873" } }, "parameters": { "location": { "type": "string" }, "itemName": { "type": "string" }, "ddosProtectionId": { "type": "string" } }, "variables": { "enableDDOS": "[not(empty(parameters('ddosProtectionId')))]" }, "resources": [ { "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2022-07-01", "name": "[parameters('itemName')]", "location": "[parameters('location')]", "properties": { "addressSpace": { "addressPrefixes": [ "10.0.0.0/8" ] }, "enableDdosProtection": "[variables('enableDDOS')]", "ddosProtectionPlan": "[if(not(variables('enableDDOS')), null(), createObject('id', parameters('ddosProtectionId')))]", "subnets": [ { "name": "defSubnet", "properties": { "addressPrefix": "10.2.0.0/16", "privateEndpointNetworkPolicies": "Disabled", "serviceEndpoints": [ { "service": "Microsoft.AzureCosmosDB", "locations": [ "[parameters('location')]" ] }, { "service": "Microsoft.Storage", "locations": [ "[parameters('location')]" ] } ] } }, { "name": "pubSubnet", "properties": { "addressPrefix": "10.3.0.0/16", "privateEndpointNetworkPolicies": "Disabled", "serviceEndpoints": [ { "service": "Microsoft.AzureCosmosDB", "locations": [ "[parameters('location')]" ] }, { "service": "Microsoft.Storage", "locations": [ "[parameters('location')]" ] } ] } }, { "name": "aksSubnet", "properties": { "addressPrefix": "10.4.0.0/16", "privateEndpointNetworkPolicies": "Disabled", "serviceEndpoints": [ { "service": "Microsoft.AzureCosmosDB", "locations": [ "[parameters('location')]" ] }, { "service": "Microsoft.Storage", "locations": [ "[parameters('location')]" ] } ] } }, { "name": "funcSubnet", "properties": { "addressPrefix": "10.1.0.0/24", "privateEndpointNetworkPolicies": "Disabled", "serviceEndpoints": [ { "service": "Microsoft.AzureCosmosDB", "locations": [ "[parameters('location')]" ] }, { "service": "Microsoft.Storage", "locations": [ "[parameters('location')]" ] } ], "delegations": [ { "id": "[guid(format('{0}funcSubnet/delegations/Microsoft.Web.serverFarms', parameters('itemName')))]", "name": "Microsoft.Web.serverFarms", "properties": { "serviceName": "Microsoft.Web/serverFarms" }, "type": "Microsoft.Network/virtualNetworks/subnets/delegations" } ] } } ] } } ], "outputs": { "id": { "type": "string", "value": "[resourceId('Microsoft.Network/virtualNetworks', parameters('itemName'))]" }, "defSubnetId": { "type": "string", "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('itemName'), 'defSubnet')]" }, "aksSubnetId": { "type": "string", "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('itemName'), 'aksSubnet')]" }, "pubSubnetId": { "type": "string", "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('itemName'), 'pubSubnet')]" }, "functionSubnetId": { "type": "string", "value": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('itemName'), 'funcSubnet')]" }, "vNetName": { "type": "string", "value": "[parameters('itemName')]" } } } }, "dependsOn": [ "[resourceId('Microsoft.Resources/deployments', 'Deploy-DDOSProtection')]" ] }, { "condition": "[variables('isVnetEnabled')]", "copy": { "name": "dnsZone", "count": "[length(variables('finalDnzZoneNameList'))]" }, "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "[format('dnsZone-{0}', variables('finalDnzZoneNameList')[copyIndex()])]", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "dnsZoneName": { "value": "[variables('finalDnzZoneNameList')[copyIndex()]]" }, "virtualNetworkId": "[if(variables('isVnetEnabled'), createObject('value', reference(resourceId('Microsoft.Resources/deployments', 'Deploy-VirtualNetwork'), '2020-10-01').outputs.id.value), createObject('value', ''))]", "virtualNetworkName": "[if(variables('isVnetEnabled'), createObject('value', reference(resourceId('Microsoft.Resources/deployments', 'Deploy-VirtualNetwork'), '2020-10-01').outputs.vNetName.value), createObject('value', ''))]" }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "6811790513359041528" } }, "parameters": { "dnsZoneName": { "type": "string" }, "virtualNetworkId": { "type": "string" }, "virtualNetworkName": { "type": "string" } }, "resources": [ { "type": "Microsoft.Network/privateDnsZones", "apiVersion": "2018-09-01", "name": "[parameters('dnsZoneName')]", "location": "global" }, { "type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks", "apiVersion": "2018-09-01", "name": "[format('{0}/{1}', parameters('dnsZoneName'), parameters('virtualNetworkName'))]", "location": "global", "properties": { "registrationEnabled": false, "virtualNetwork": { "id": "[parameters('virtualNetworkId')]" } }, "dependsOn": [ "[resourceId('Microsoft.Network/privateDnsZones', parameters('dnsZoneName'))]" ] } ], "outputs": { "privateDNSZoneId": { "type": "string", "value": "[resourceId('Microsoft.Network/privateDnsZones', parameters('dnsZoneName'))]" } } } }, "dependsOn": [ "[resourceId('Microsoft.Resources/deployments', 'Deploy-VirtualNetwork')]" ] }, { "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "[format('{0}-logAnalyticsWorkspace', variables('projectName'))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "location": { "value": "[parameters('location')]" }, "projectName": { "value": "[variables('projectName')]" } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "4032832480136771144" } }, "parameters": { "location": { "type": "string" }, "projectName": { "type": "string" } }, "variables": { "logAnalyticsWorkspaceName": "[format('logAnalyticsWorkspace-{0}', parameters('projectName'))]" }, "resources": [ { "type": "Microsoft.OperationalInsights/workspaces", "apiVersion": "2022-10-01", "name": "[variables('logAnalyticsWorkspaceName')]", "location": "[parameters('location')]" } ], "outputs": { "logAnalyticsWorkspaceName": { "type": "string", "value": "[variables('logAnalyticsWorkspaceName')]" }, "logAnalyticsWorkspaceId": { "type": "string", "value": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('logAnalyticsWorkspaceName'))]" } } } } }, { "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "repositoryResourcesDeployment", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "location": { "value": "[parameters('location')]" }, "projectName": { "value": "[variables('projectName')]" }, "resourceGroupName": { "value": "[resourceGroup().name]" }, "aksSubnetId": "[if(variables('isVnetEnabled'), createObject('value', reference(resourceId('Microsoft.Resources/deployments', 'Deploy-VirtualNetwork'), '2020-10-01').outputs.aksSubnetId.value), createObject('value', ''))]", "logAnalyticsWorkspaceId": { "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-logAnalyticsWorkspace', variables('projectName'))), '2020-10-01').outputs.logAnalyticsWorkspaceId.value]" } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "9138690770947712448" } }, "parameters": { "location": { "type": "string" }, "projectName": { "type": "string" }, "resourceGroupName": { "type": "string" }, "aksSubnetId": { "type": "string", "defaultValue": "" }, "logAnalyticsWorkspaceId": { "type": "string" } }, "variables": { "aksClusterName": "[format('aks-cluster-{0}', parameters('projectName'))]", "mdsDeploymentScriptIdentity": "mdsDeploymentScriptIdentity" }, "resources": [ { "type": "Microsoft.ManagedIdentity/userAssignedIdentities", "apiVersion": "2018-11-30", "name": "[variables('mdsDeploymentScriptIdentity')]", "location": "[parameters('location')]" }, { "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "aksUserAssignedId", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "principalId": { "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('mdsDeploymentScriptIdentity')), '2018-11-30').principalId]" }, "roleAssignmentName": { "value": "[guid(format('{0}ownerResourceGroup', resourceGroup().id))]" } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "12916380371283930136" } }, "parameters": { "roleAssignmentName": { "type": "string" }, "principalId": { "type": "string" } }, "variables": { "ownerRoleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]" }, "resources": [ { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2020-10-01-preview", "name": "[parameters('roleAssignmentName')]", "properties": { "roleDefinitionId": "[variables('ownerRoleDefinitionId')]", "principalId": "[parameters('principalId')]", "principalType": "ServicePrincipal" } } ] } }, "dependsOn": [ "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('mdsDeploymentScriptIdentity'))]" ] }, { "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "[format('{0}-AKS-Deployment', parameters('projectName'))]", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "location": { "value": "[parameters('location')]" }, "aksClusterName": { "value": "[variables('aksClusterName')]" }, "mdsDeploymentScriptIdentity": { "value": "[variables('mdsDeploymentScriptIdentity')]" }, "resourceGroupName": { "value": "[parameters('resourceGroupName')]" }, "subnetId": { "value": "[parameters('aksSubnetId')]" }, "logAnalyticsWorkspaceId": { "value": "[parameters('logAnalyticsWorkspaceId')]" } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "9670365158099726916" } }, "parameters": { "aksClusterName": { "type": "string" }, "location": { "type": "string" }, "mdsDeploymentScriptIdentity": { "type": "string" }, "resourceGroupName": { "type": "string" }, "subnetId": { "type": "string", "defaultValue": "" }, "logAnalyticsWorkspaceId": { "type": "string" } }, "variables": { "hasSubnet": "[not(empty(parameters('subnetId')))]", "mdsId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('mdsDeploymentScriptIdentity'))]" }, "resources": [ { "type": "Microsoft.ContainerService/managedClusters", "apiVersion": "2022-10-02-preview", "name": "[parameters('aksClusterName')]", "location": "[parameters('location')]", "properties": { "nodeResourceGroup": "[format('MC_{0}_{1}', parameters('resourceGroupName'), parameters('aksClusterName'))]", "enableRBAC": true, "publicNetworkAccess": "Enabled", "dnsPrefix": "[format('{0}-dns', parameters('aksClusterName'))]", "disableLocalAccounts": false, "apiServerAccessProfile": "[if(variables('hasSubnet'), createObject('enablePrivateCluster', true()), null())]", "networkProfile": { "loadBalancerSku": "standard", "networkPlugin": "azure", "serviceCidr": "10.0.0.0/16", "dnsServiceIP": "10.0.0.10", "dockerBridgeCidr": "172.17.0.1/16" }, "securityProfile": "[if(variables('hasSubnet'), createObject('defender', createObject('logAnalyticsWorkspaceResourceId', parameters('logAnalyticsWorkspaceId'), 'securityMonitoring', createObject('enabled', true()))), null())]", "addonProfiles": "[if(variables('hasSubnet'), createObject('httpApplicationRouting', createObject('enabled', false()), 'azurepolicy', createObject('enabled', true()), 'azureKeyvaultSecretsProvider', createObject('enabled', false(), 'config', null()), 'omsAgent', createObject('enabled', true(), 'config', createObject('logAnalyticsWorkspaceResourceId', parameters('logAnalyticsWorkspaceId')))), null())]", "agentPoolProfiles": [ { "name": "systempool", "osDiskSizeGB": 0, "count": 3, "enableAutoScaling": true, "minCount": 1, "maxCount": 5, "vmSize": "Standard_DS2_v2", "osType": "Linux", "type": "VirtualMachineScaleSets", "mode": "System", "maxPods": 110, "availabilityZones": [ "1", "2", "3" ], "enableNodePublicIP": false, "vnetSubnetID": "[if(variables('hasSubnet'), parameters('subnetId'), null())]" }, { "name": "apppool", "osDiskSizeGB": 0, "count": 3, "enableAutoScaling": true, "minCount": 1, "maxCount": 5, "vmSize": "Standard_DS2_v2", "osType": "Linux", "type": "VirtualMachineScaleSets", "mode": "User", "maxPods": 110, "availabilityZones": [ "1", "2", "3" ], "enableNodePublicIP": false, "vnetSubnetID": "[if(variables('hasSubnet'), parameters('subnetId'), null())]" } ] }, "identity": { "type": "UserAssigned", "userAssignedIdentities": { "[format('{0}', variables('mdsId'))]": {} } } }, { "condition": "[variables('hasSubnet')]", "type": "Microsoft.Resources/deployments", "apiVersion": "2020-10-01", "name": "Deploy-Endpoint-AKS", "properties": { "expressionEvaluationOptions": { "scope": "inner" }, "mode": "Incremental", "parameters": { "serviceId": { "value": "[resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName'))]" }, "itemName": { "value": "[format('endp-{0}', parameters('aksClusterName'))]" }, "location": { "value": "[parameters('location')]" }, "subnetId": { "value": "[parameters('subnetId')]" }, "connName": { "value": "[format('conn-{0}', parameters('aksClusterName'))]" }, "groupId": { "value": "management" } }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.13.1.58284", "templateHash": "17380082270552191032" } }, "parameters": { "itemName": { "type": "string" }, "location": { "type": "string" }, "subnetId": { "type": "string" }, "connName": { "type": "string" }, "groupId": { "type": "string" }, "serviceId": { "type": "string" }, "privateDNSZoneNameList": { "type": "array", "defaultValue": [] } }, "variables": { "enableDns": "[not(empty(parameters('privateDNSZoneNameList')))]", "subscriptionID": "[subscription().subscriptionId]", "resourceGroupName": "[resourceGroup().name]", "nicName": "[format('nic-{0}', parameters('itemName'))]" }, "resources": [ { "type": "Microsoft.Network/privateEndpoints", "apiVersion": "2022-01-01", "name": "[parameters('itemName')]", "location": "[parameters('location')]", "properties": { "subnet": { "id": "[parameters('subnetId')]" }, "customNetworkInterfaceName": "[variables('nicName')]", "privateLinkServiceConnections": [ { "name": "[parameters('connName')]", "properties": { "privateLinkServiceId": "[parameters('serviceId')]", "groupIds": [ "[parameters('groupId')]" ] } } ] } }, { "condition": "[variables('enableDns')]", "type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups", "apiVersion": "2022-01-01", "name": "[format('{0}/{1}', parameters('itemName'), 'default')]", "properties": { "copy": [ { "name": "privateDnsZoneConfigs", "count": "[length(parameters('privateDNSZoneNameList'))]", "input": { "name": "[format('{0}-{1}', parameters('itemName'), parameters('privateDNSZoneNameList')[copyIndex('privateDnsZoneConfigs')])]", "properties": { "privateDnsZoneId": "[format('/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/privateDnsZones/{2}', variables('subscriptionID'), variables('resourceGroupName'), parameters('privateDNSZoneNameList')[copyIndex('privateDnsZoneConfigs')])]" } } } ] }, "dependsOn": [ "[resourceId('Microsoft.Network/privateEndpoints', parameters('itemName'))]" ] } ] } }, "dependsOn": [ "[resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName'))]" ] } ], "outputs": { "aksClusterName": { "type": "string", "value": "[parameters('aksClusterName')]" }, "aksPrincipalId": { "type": "string", "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('mdsDeploymentScriptIdentity')), '2018-11-30').principalId]" }, "aksClusterTenantId": { "type": "string", "value": "[tenant().tenantId]" }, "aksClusterHost": { "type": "string", "value": "[reference(resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName')), '2022-10-02-preview').azurePortalFQDN]" }, "aksClusterKubeletIdentityObjectId": { "type": "string", "value": "[reference(resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName')), '2022-10-02-preview').identityProfile.kubeletidentity.objectId]" }, "aksClusterKubeletIdentityClientId": { "type": "string", "value": "[reference(resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName')), '2022-10-02-preview').identityProfile.kubeletidentity.clientId]" }, "aksClusterKubeletMSIResourceId": { "type": "string", "value": "[reference(resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName')), '2022-10-02-preview').identityProfile.kubeletidentity.resourceId]" }, "aksRI": { "type": "string", "value": "[resourceId('Microsoft.ContainerService/managedClusters', parameters('aksClusterName'))]" } } } }, "dependsOn": [ "[resourceId('Microsoft.Resources/deployments', 'aksUserAssignedId')]", "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('mdsDeploymentScriptIdentity'))]" ] } ], "outputs": { "aksClusterName": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksClusterName.value]" }, "aksClusterHost": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksClusterHost.value]" }, "aksPrincipalId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksPrincipalId.value]" }, "aksClusterKubeletIdentityObjectId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksClusterKubeletIdentityObjectId.value]" }, "aksClusterTenantId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksClusterTenantId.value]" }, "aksClusterKubeletIdentityClientId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksClusterKubeletIdentityClientId.value]" }, "aksClusterKubeletMSIResourceId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksClusterKubeletMSIResourceId.value]" }, "mdsDeploymentScriptIdentity": { "type": "string", "value": "[variables('mdsDeploymentScriptIdentity')]" }, "mdsDeploymentScriptIdentityObjectId": { "type": "string", "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('mdsDeploymentScriptIdentity')), '2018-11-30').principalId]" }, "mdsDeploymentScriptIdentityClientId": { "type": "string", "value": "[reference(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', variables('mdsDeploymentScriptIdentity')), '2018-11-30').clientId]" }, "aksRI": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}-AKS-Deployment', parameters('projectName'))), '2020-10-01').outputs.aksRI.value]" } } } }, "dependsOn": [ "dnsZone", "[resourceId('Microsoft.Resources/deployments', format('{0}-logAnalyticsWorkspace', variables('projectName')))]", "[resourceId('Microsoft.Resources/deployments', 'Deploy-VirtualNetwork')]" ] } ], "outputs": { "aksRI": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', 'repositoryResourcesDeployment'), '2020-10-01').outputs.aksRI.value]" }, "uniqueNameForResources": { "type": "string", "value": "[variables('uniqueNameForResources')]" }, "resourcesDeploymentRegion": { "type": "string", "value": "[parameters('location')]" }, "subscriptionId": { "type": "string", "value": "[subscription().subscriptionId]" }, "blobStorageResourceGroup": { "type": "string", "value": "[resourceGroup().name]" }, "aksClusterTenantId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', 'repositoryResourcesDeployment'), '2020-10-01').outputs.aksClusterTenantId.value]" }, "aksClusterPrincipalId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', 'repositoryResourcesDeployment'), '2020-10-01').outputs.aksPrincipalId.value]" }, "aksClusterName": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', 'repositoryResourcesDeployment'), '2020-10-01').outputs.aksClusterName.value]" }, "aksClusterKubeletIdentityObjectId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', 'repositoryResourcesDeployment'), '2020-10-01').outputs.aksClusterKubeletIdentityObjectId.value]" }, "aksClusterKubeletIdentityClientId": { "type": "string", "value": "[reference(resourceId('Microsoft.Resources/deployments', 'repositoryResourcesDeployment'), '2020-10-01').outputs.aksClusterKubeletIdentityClientId.value]" } } }

Expected response (i.e. "I expected no noise since the template has not been modified since the resources were deployed) I expected no noise since the template has not been modified since the resources were deployed but actually getting below response:

Current (noisy) response (either include a screenshot of the what-if output, or copy/paste the text) InvalidTemplateDeployment - The template deployment 'main' is not valid according to the validation procedure. The tracking id is '76d486b4-0fdd-4417-85f6-81a6d7d57147'. See inner errors for details. GetLogAnalyticsWorkspaceError - Provisioning of resource(s) for container service aks-cluster-mci4m-gvag7nhncxf4i in resource group failed. Message: Unable to get log analytics workspace info. Resource ID: /subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/logAnalyticsWorkspace-mci4m-gvag7nhncxf4i. Details: Category: ClientError; Code: GetLogAnalyticsWorkspaceError; SubCode: ResourceNotFound; Message: Unable to retrieve log analytics workspace. Please resolve the issue below and try again. If resource is intentionally deleted to stop monitoring, please also disable monitoring addon by following doc: https://aka.ms/aks-disable-monitoring-addon. If resource is deleted by mistake, please re-create it by following doc: https://aka.ms/new-log-analytics, and enable new workspace resource id by following doc: https://aka.ms/aks-enable-addons. Resource ID: /subscriptions//resourceGroups//providers/Microsoft.OperationalInsights/workspaces/logAnalyticsWorkspace-mci4m-gvag7nhncxf4. Error details: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.OperationalInsights/workspaces/logAnalyticsWorkspace-mci4m-gvag7nhncxf4i' under resource group was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix".; InnerMessage: ; Dependency: Microsoft.OperationalInsights/workspaces; AKSTeam: RP; OriginalError: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.OperationalInsights/workspaces/logAnalyticsWorkspace-mci4m-gvag7nhncxf4i' under resource group was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"; Retriable: false. Please recreate or unlock the log analytics workspace before proceed the last operation. For more details about how to create and use log analytics workspace, please refer to: https://aka.ms/new-log-analytics. Details:

Additional context Add any other context about the problem here.

anag2022 commented 11 months ago

@shagun-varshney, any updates on this issue? did you find the cause?

nachab commented 7 months ago

Same problem when I try to deploy a remediation from azure policy. The Log Analytics workspace is not found. I tested with the API '2022-09-01'.

It works if I can StrongType in the Azure Policy

@shagun-varshney, any updates on this issue? did you find the cause?

Preflight validation check for resource(s) for container service "" in resource group failed. Message: Unable to get log analytics workspace info. Resource ID: "/subscriptions/resourceGroups//providers/Microsoft.OperationalInsights/workspaces/test-aks-nacho-policy". Details: Category: ClientError; Code: ResourceNotFound; SubCode: ResourceNotFound; Message: Unable to retrieve log analytics workspace. Please resolve the issue below and try again. If resource is intentionally deleted to stop monitoring, please also disable monitoring addon by following doc: https://aka.ms/aks-disable-monitoring-addon. If resource is deleted by mistake, please re-create it by following doc: https://aka.ms/new-log-analytics, and enable new workspace resource id by following doc: https://aka.ms/aks-enable-addons. Resource ID: /subscriptions//resourceGroups/providers/Microsoft.OperationalInsights/workspaces/test-aks-nacho-policy%22. Error details: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.OperationalInsights/workspaces/test-aks-nacho-policy\"' under resource group was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix".. autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.OperationalInsights/workspaces/ws_name\"' under resource group was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"; InnerMessage: ; Dependency: Microsoft.OperationalInsights/workspaces; AKSTeam: RP; OriginalError: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.OperationalInsights/workspaces/' under resource group '' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix". Please recreate or unlock the log analytics workspace before proceed the last operation. For more details about how to create and use log analytics workspace, please refer to: https://aka.ms/new-log-analytics. Details: . Click here for details