Inspec is the most common tool to do a complinace testing for the deployed infrastructure resources. very helpful in verifying that servers and applications you install are configured correctly and fulfill all compliance requirements by hand is tedious and error-prone. Chef comes with InSpec, a human-readable language for compliance auditing and testing your infrastructure. With InSpec, you can write automated tests to verify a host of criteria on your servers: from the contents of certain files to applications running on certain ports, you can make sure that your servers and applications are configured correctly.
Chef Azure-Inspec: is a resource pack provided by Chef that uses the Azure REST API, to allow you to write tests for resources that you have deployed in Microsoft Azure. These tests can be used to validate the Azures resources that were deployed via code using Terraform or Azure RM templates. Inspec is an open source framework that is used for testing and auditing your infrastructure, in this blog post I will show how you can create tests against your Azure resources using Inspec-Azure.
Users can now run InSpec natively as a part of the Azure Cloud Shell experience. This allows everyone using Cloud Shell to easily run InSpec compliance scans right from their browser!
Due to the latest packages changes, running inspec-azure against your Azure Resources to test will fail! so here is the guide on how to fix this issue:
1- Login to Azure Portal, and open Azure CLI
2- Create a new Inspec profile as below
3- Now, if you run or execure the test you will get this error "Profile URL dependency https://github.com/inspec/inspec-azure/archive/master.tar.gz could not be fetched: 404 Not Found"
In order to fix this issue, you need first to make small change on inspec.yml file since master branch is not used anymore
4- Open Editor view and edit inspec.yml file as below
5- Replace the url with this link: https://github.com/inspec/inspec-azure/archive/main.tar.gz
6- Save the change and close the editor
7- Run the test again
Waaaw, that's work :)
Note: You can apply the same fix on Windows, Linux, MacOS,,,,etc
Mohammad Al Rousan is a Microsoft MVP (Azure), Microsoft Certified Solution Expert (MCSE) in Cloud Platform & Azure DevOps & Infrastructure, An active community blogger and speaker.
Al Rousan has over 8 years of professional experience in IT Infrastructure and very passionate about Microsoft technologies and products.
Top 10 Microsoft Azure Blogs