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:

[pastacode lang=”markdown” manual=”%23%20%22Donor%22%20machine%20%0A%23%23%20Install%20%22custom%22%20module%0AInstall-Module%20-Name%20Az%20-RequiredVersion%203.7.0%20-Scope%20CurrentUser%20-Force%0A%0A%23%23%20Export%20%22custom%22%20module%0ASave-Module%20-Name%20Az%20-Path%20’C%3A%5CUsers%5Ckag%5CDocuments%5Cps_modules’%20-RequiredVersion%203.7.0%20-Force%0A%0A%23%20%22donee%22%20machine%0A%23%23%20Add%20custom%20path%20with%20%22custom%22%20modules%20to%20PSModulePath%20%0A%23%23%20..AND%20keep%20only%20%22system%22%20path%20from%20defaults%2C%20%0A%23%23..%20%60C%3A%5CUsers%5Cuser%5CDocuments%5CWindowsPowerShell%5CModules%60%20and%20%60C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%60%20%0A%23%23%20..have%20to%20be%20removed%20in%20order%20to%20avoid%20conflicts%20between%20installed%20and%20%22custom%22%20modules%0A%24env%3APSModulePath%20%3D%20%24env%3APSModulePath%20%2B%20%22C%3A%5CUsers%5Ckag%5CDocuments%5Cps_modules%3BC%3A%5CWindows%5Csystem32%5CWindowsPowerShell%5Cv1.0%5CModules%22%0A%0A%23%23%20Unblock%20all%20files%20because%20some%20dll’s%20could%20be%20locked%20%0AGet-ChildItem%20%22C%3A%5CUsers%5Ckag%5CDocuments%5Cps_modules%5C*%22%20-Recurse%20%7C%20Unblock-File%0A%0A%23%23%20Import%20%22custom%22%20module%20and%20check%20that%20it’s%20listed%20in%20usable%20but%20not%20installed%20list%0AImport-Module%20-name%20%22C%3A%5CUsers%5Ckag%5CDocuments%5Cps_modules%5CAz%22%20-Verbose%0A%0A%23%23%20Check%20that%20module%20is%20ready%20to%20be%20used%0AGet-Module%20-Name%20Az%0A%0A%23%23%20Check%20that%20module%20isn’t%20really%20installed%0AGet-InstalledModule%20-Name%20Az%20-AllVersions%0A” message=”” highlight=”” provider=”manual”/]

 

AWS CloudFormation EC2 Win AD servers

Task

  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

Solution

https://github.com/kagarlickij/aws-cloudformation-ec2-win-ad-servers

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 – https://github.com/kagarlickij/azure-fabric-arm

Now let’s see how it can be implemented:

Continue reading