Skip to main content

Posts

Showing posts from July, 2019

Ansible Azure Storage table

Background Client gave us controlled Azure Subscriptions where we are not able to create anything manually using Azure portal. Client’s Dev team has setup Ansible and some roles to work with Azure Resources (e.g. there are roles to create logic apps, storage account, service bus, azure function etc.). In order to create/modify any resource in Azure, we have to use pre-defined Ansible roles. Problem Statement Development team has a requirement to use Azure Storage Table in the code. There is no role available in client’s Ansible Role repository to create storage account. Solution Approaches REST API Approach To create storage table, there are REST APIs, which we can use, but problem with REST API is that we need to have Authorization Header in the request, and in order to get the authorization header, we need to authenticate using Storage Account connection string. Since we have controlled environments, storage account connection strings (which are stored in

Top 10 Processes using CPU

I came up with following to get CPU% of top 10 process. this can be useful to you as well. $ CpuCores = ( Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors ( Get-Counter "\Process(*)\% Processor Time" ).CounterSamples | Select InstanceName, @ { Name = "CPU %" ; Expression ={[ Decimal ]::Round(( $ _ .CookedValue / $ CpuCores ), 2 )}} | sort *CPU* -Descending | select -First 10