Author Archives: Kagarlickij Dmitriy

Export PowerShell modules to be used offline

There could be a situation when PowerShell modules have to be used on machine without internet access so here’s quick instruction how to deal with “donor” and “donee” machines:

# "Donor" machine 
## Install "custom" module
Install-Module -Name Az -RequiredVersion 3.7.0 -Scope CurrentUser -Force

## Export "custom" module
Save-Module -Name Az -Path 'C:\Users\kag\Documents\ps_modules' -RequiredVersion 3.7.0 -Force

# "donee" machine
## Add custom path with "custom" modules to PSModulePath 
## ..AND keep only "system" path from defaults, 
##.. `C:\Users\user\Documents\WindowsPowerShell\Modules` and `C:\Program Files\WindowsPowerShell\Modules` 
## ..have to be removed in order to avoid conflicts between installed and "custom" modules
$env:PSModulePath = $env:PSModulePath + "C:\Users\kag\Documents\ps_modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules"

## Unblock all files because some dll's could be locked 
Get-ChildItem "C:\Users\kag\Documents\ps_modules\*" -Recurse | Unblock-File

## Import "custom" module and check that it's listed in usable but not installed list
Import-Module -name "C:\Users\kag\Documents\ps_modules\Az" -Verbose

## Check that module is ready to be used
Get-Module -Name Az

## Check that module isn't really installed
Get-InstalledModule -Name Az -AllVersions


AWS CloudFormation EC2 Win AD servers


  1. EC2 instances must be automatically added to Active Directory (AD) on provisioning and removed form AD on termination
  2. Each EC2 instance must have 3 private IP addresses (required for MS SQL Always-On) assigned by DHCP
  3. NLB must be used to expose MS SQL Always-On Listener because it’s faster than changing CNAME value
  4. Dedicated ASG to keep each instance fault tolerant
  5. Dedicated data disks which are re-attached to new instance in ASG with the same disk letters


Continue reading

Cloud agnostic approach with Terraform

If you’ve been working with both AWS and Azure you should have noticed that each of them has some advantages.

Tools like Terraform might be very helpful if you’re not familiar with both CloudFormation and Azure RM.

However don’t consider Terraform as a nonpareil (this is not true at all), it is simple tool for simple tasks.

So in this  post I’ll tell you about Terraform terms and concepts and show example with AWS & Azure.

For a bit more complicated infrastructure you’ll have to use CloudFormation and Azure RM

Continue reading

Create custom Azure Fabric cluster

When you start working with Azure Service Fabric you might be disappointed with customisation possibilities.

So even if you just want to add a few Internal Load balancers you have to customise ARM template.

When you working with ARM templates it might be good idea to split VNet and KeyVaults from computing resources.

To make provision easier you can use PowerShell scripts, like this one for certificates.

Full solution you can find in my GitHub –

Now let’s see how it can be implemented:

Continue reading