Thursday, April 27, 2017

How to download individual files from GitHub enterprise


Below instructions how to download individual files from private GitHub repository using powershell.


  1. Your GitHub repository is hosted at
  2. Your organisation name is my-org
  3. Your repository name is my-repo
  4. Path to file you are trying to download is /myfiles/file.txt


  1. Obtain personal access token for you account by navigating to your account and choosing settings.
  2. Go to Personal Access Token setting and choose "Generate New Token". Copy the resulting token key.
  3. Construct URL to the file you are trying to download in following format:
  4. Powershell script to download file is below. Values in italic are variables which will be different in your environment

Invoke-WebRequest -Headers @{"Authorization"="token 8d795936d2c1b2806587719b9b6456bd16549ad8";"Accept"= "application/vnd.github.v3.raw"}

If you need to download entire contents of your master branch then request will look like below

Invoke-WebRequest -Headers @{"Authorization"="token 8d795936d2c1b2806587719b9b6456bd16549ad8"} -OutFile

Friday, February 24, 2017

IIS WebDav hosting using IIS Manager Users to authentication

Enabling IIS WebDav functionality by using IIS Manager Users

Setting up IIS WebDav functionality is pretty trivial if one to rely on Windows user accounts for authentication but this architecture causing massive issues, namely:

  1. Accounts have to be precreated in Windows and are in fact real Windows accounts with permissions through system. I frequently see people while troubleshooting WebDav authentication issues adding those users to various group (in addition to default Users group) including Administrators account. 
  2. It's difficult to maintain since those users accounts are specific to machine where they live and hence not trivial to extend setup to several servers without keeping all accounts in sync.
Instead we can rely on IIS Manager to store and maintain users which was designed to allow hosting providers to provide remote IIS management functionality to customers. This setup remove all the drawbacks of using Windows users as authentication provider. It's easily scalable (since IIS shared configuration can be used) and do not provide any sort of access to underlying operating system.
Solution consists of 2 DSC scripts below. Instead of using UI to set this up DSC was chosen since it's easily replicated at scale and provide reproducible and consistent behavior.
Prerequisites.ps1 which performs following:

  1. Install basic IIS features
  2. Enabled remote management to enable IIS Manager User features
  3. Install Nuget and chocolatey providers to pull required DSC resources to create website and manipulate NTFS permissions
Startup.ps1 which performs following:

  1. Enables WebDav and neccessary features
  2. Configured IIS Manager to accept both Windows and IIS Manager credentials
  3. Modifies permissions to allow IIS_IUSRS users to read configuration file
  4. Creates website and bindings it to default ports
  5. Create IIS manager users with the password
  6. Modifies IIS configuration to allow WebDav publishing based off IIS Manager credentials provider
  7. Assigns WebDav permissions to newly created users to access website


Friday, January 20, 2017

Windows Containers Walkthrough

Wiki referenced below provides step by steps instructions how to start working with Windows Containers. It's work in progress but basics steps are already there.

Windows Containers Walktrhough