Title
Help to fix the bug which occurs when running Get-AzSKARMTemplateSecurityStatus command on a bad ARM template
Description
I have an ARM template and I am running a security scan against it. When I run the Get-AzSKARMTemplateSecurityStatus command, it hangs in between the scan. It doesn't end or give any errors, just hangs.
Here is my ARM template:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"AppServiceName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
"DomainName": {
"type": "string"
},
"AzureFunction.StorageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS"
],
"metadata": {
"description": "Storage Account type"
}
},
"AzureFunction.StorageAccountName": {
"type": "string"
},
"AppInsightsLocation": {
"type": "string"
},
"HostingPlanName": {
"type": "string"
},
"HostingPlanResourceGroup": {
"type": "string"
},
"SSLThumbprint": {
"type": "string",
"metadata": {
"description": "The thumbprint of the SSL certificate as it should be defined in a hosting plan"
}
}
},
"variables": {
"storageAccountid": "[concat(resourceGroup().id,'/providers/','Microsoft.Storage/storageAccounts/', parameters('AzureFunction.StorageAccountName'))]",
"serverFarmId": "[resourceId(parameters('HostingPlanResourceGroup'),'Microsoft.Web/serverfarms/', parameters('HostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-05-01",
"name": "[parameters('AppServiceName')]",
"type": "Microsoft.Insights/components",
"location": "[parameters('AppInsightsLocation')]",
"properties": {
"applicationId": "[parameters('AppServiceName')]"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('AzureFunction.StorageAccountName')]",
"apiVersion": "2017-06-01",
"location": "[resourceGroup().location]",
"kind": "Storage",
"sku": {
"name": "[parameters('AzureFunction.StorageAccountType')]"
}
},
{
"apiVersion": "2016-08-01",
"type": "Microsoft.Web/sites",
"name": "[parameters('AppServiceName')]",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', parameters('AppServiceName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('AzureFunction.StorageAccountName'))]"
],
"properties": {
"enabledHostnames": [ "[parameters('DomainName')]" ],
"hostNameSslStates": [
{
"name": "[parameters('DomainName')]",
"sslState": "SniEnabled",
"thumbprint": "[parameters('SSLThumbprint')]",
"toUpdate": true
}
],
"serverFarmId": "[variables('serverFarmId')]"
},
"resources": [
{
"apiVersion": "2016-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[concat('Microsoft.Web/sites/',parameters('AppServiceName'))]"
],
"properties": {
}
}
]
},
{
"type": "Microsoft.Web/sites/hostnameBindings",
"name": "[concat(parameters('AppServiceName'),'/',parameters('DomainName'))]",
"apiVersion": "2016-08-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Web/sites/',parameters('AppServiceName'))]"
],
"properties": {
"domainId": null,
"hostNameType": "Verified",
"siteName": "[parameters('DomainName')]",
"toUpdate": true
}
}
],
"outputs": {
"AppInsightsInstrumentationKey": {
"value": "[reference(resourceId('Microsoft.Insights/components', parameters('AppServiceName')), '2015-05-01').InstrumentationKey]",
"type": "string"
}
}
}
Save this ARM somewhere on your File System to reproduce the issue.
Steps to reproduce
Get-AzSKARMTemplateSecurityStatus -ARMTemplatePath "PathToTheAboveARM"
Expected behavior
It should result in giving me an ARMChecker folder with the result in the form of csv file and the PowerShell output file.
Actual behavior
It hangs in between the security scan.
Is it a known issue? When any bad ARM template receives as an input to the command, it hangs?
Could you please work on this bug of handling the hang issue?