Access Compliance Data and Manage Compliance for Azure Resources

In our previous blog post, we discussed how we can write custom Azure Policies in accordance with Organization’s Strategic and Compliance Requirements. We also learned how to apply policies at different scope levels in Azure. While planning, writing and applying compliance requirements in the form of Azure Policies is important, it is equally important to audit existing resources for appropriate configurations and settings, evaluate the results and take certain actions. One needs to be evaluate how many resources are compliant with the defined requirements, what resources are non-compliant, what corrective actions can be taken to bring them in compliance and also remove any false positives.
Continue reading “Access Compliance Data and Manage Compliance for Azure Resources”

Create and Assign Custom Azure Policies for Azure Governance

In our previous blog post, we discussed on using Azure Policies for Azure Governance and staying compliant with the same. We also discussed how we can use built-in Azure Policies to meet the governance criteria and start easily. However, the relationship between business and IT varies a lot from Organization to Organization. So from time to time, you’ll need to create your own Azure Policies and applying them to a scope. Custom Azure policies allows you to be lot more compliant and a lot more flexible. In this blog post, we are going to discuss the same. Continue reading “Create and Assign Custom Azure Policies for Azure Governance”

Write Verbose Output in PowerShell using Write-Verbose

It is good practice to use the various -Verbose, -Debug and other about_CommonParameters when writing functions because it helps one to write the clean code in a very integrated way with the PowerShell. This blog post focuses on the usage of Verbose command to provide detailed tracking information and status. One of the main benefits about using Write-Verbose command is that you can control, if you need extra detailed information. By default, the verbose message stream is not displayed, but you can display it by changing the value of the $VerbosePreference variable or using the Verbose common parameter in any command. Also, Write-Verbose writes to the verbose output stream and you can capture it separately.
Continue reading “Write Verbose Output in PowerShell using Write-Verbose”

Return Multiple Values from PowerShell Function

In PowerShell functions, by default, you can return only one object at a time. Since PowerShell does not apply any restriction on data type returned, it created a lot of possibilities on what can be returned as an output of the function. So if one needs to return multiple values or objects, it is generally suggested to create an array of the objects and then return the array. If the underlying values are simple strings, some would create a custom PSObject and then return the PSObject. In this blog post, we will discuss the other methods to return the multiple values from PowerShell functions.
Continue reading “Return Multiple Values from PowerShell Function”

Implement Pipeline Support by making proper use of ValueFromPipeline and ValueFromPipelineByPropertyName in PowerShell functions

In our previous post, we learned how to make use of Begin, Process and End blocks to implement proper pipeline support. Building on to that, in this blog post, we’ll learn further about when to make use of ValueFromPipeline property and when to make use of ValueFromPipelineByPropertyName and what happens behind the scenes.

Multiple parameters that accept Pipeline Input

What if there are multiple parameters that can accept pipeline input and we need to run the Process block for them. Let’s consider below code: Continue reading “Implement Pipeline Support by making proper use of ValueFromPipeline and ValueFromPipelineByPropertyName in PowerShell functions”