Just Enough Administration (JEA) – Part 2: An example

In the first part, we had a quick look at Just Enough Administration (JEA) and discussed some use cases. In this part, we are going to implement a JEA example to solve a common problem we have had for years: assigning appropriate rights to DNS admins.

I’m sure that the majority of DNS implementations in Windows environments are co-located with Active Directory domain controllers. That brings a lot of flexibility when it comes to DNS management, troubleshooting, integrated zones, and secure replication. But it’s also quite difficult to separate Active Directory and DNS management layers. In most cases, our domain administrators are also responsible for DNS. The main reason for this is that to have separate DNS admins, you need to grant “Domain Admin” rights to them.

Continue Reading…

Working with Windows 10 Bash

In my previous article, I introduced Bash for Windows 10. Since then, I have been playing with Bash on my primary Windows 10 computer (a Surface Pro 3) and I am amazed by all the opportunities it provides. In this post, I would like to talk about some cool things you can do with Bash on Windows 10.
 Some of such cool things are native Linux tasks, which we are now able to test on Windows, and some things are present just for fun. In general, however, I believe that Bash is a new way for Windows Administrators to extend their abilities and is a great addition for Linux Administrators with regard to their developer environments.

Azure Storage Services – Article Series on 4sysops.com

I recently started to post on 4sysops.com regarding Azure Storage Services.

Azure-regions

 

 

 

 

 

Here are the blogs in this series that I’m planning to publish:

Azure Storage Services — Introduction
Azure Storage Services — Accessing Services
Azure Storage Services — Storage Account
Azure Storage Services — Blob Storage
Azure Storage Services — Table Storage
Azure Storage Services — Queue Storage
Azure Storage Services — File Storage
Azure Storage Services — Premium Storage Benefits
Azure Storage Services — Security
Azure Storage Services — Useful Tools.

Azure Public Reserved IP kullanilmasi

Bilindigi gibi Azure uzerindeki sanal makineleriniz icin statik yada dinamik IP adresi yapilandirmasi gerceklestirebiliyorsunuz. Ayni sekilde dis dunyaya hizmet veren servisleriniz uzerindeki IP adreslerini de rezerve edebilme sansiniz bulunuyor. Bu sayede ilgili servisiniz durdurulsa bile uzerine atanmis olan IP adresini tutmaya devam edecektir.

Azure icerisinde suanda toplamda subscription bazina 20 adet IP rezerve edebilirsiniz. Eger daha fazla ihtiyaciniz var ise Microsoft’a bu konuda bir case acmaniz gerekiyor.

Bir servis icin public IP rezerve edebilmeniz icin oncelikle bu IP’yi subscription icerisine eklemeniz gerekiyor.

New-AzureReservedIP ReservedIPName MyReservedIP Location "Central US"

Ardindan hangi IP adresinin rezerve edildigini Get-AzureReservedIP komutu ile gorebilirsiniz.

Ardindan ilgili IPyi cloud service ile iliskilendirmeniz gerekiyor. Bunun icin de asagidaki komutu kullanabilirsiniz.

New-AzureReservedIP ReservedIPName MyReservedIP Location "Central US"
$image = Get-AzureVMImage|?{$_.ImageName -like "*RightImage-Windows-2012R2-x64*"}
New-AzureVMConfig -Name TestVM -InstanceSize Small -ImageName $image.ImageName `
| Add-AzureProvisioningConfig -Windows -AdminUsername adminuser -Password MyP@ssw0rd!! `
| New-AzureVM -ServiceName TestService -ReservedIPName MyReservedIP -Location "Central US"

 

Visual Studio 2015 – PowerShell – Github / Perfect Combo

github-logo-300x200First thing first. I started my “Development” career with PowerShell like thousands of peopleout there. Yes I have some unpleasant experiences with Delphi and PHP couple of years ago but PowerShell was the perfect match for me as a infrastructure consultant. It allows to build small and quick automation solutions to help me for my daily tasks.

Over the last couple of years PowerShell evolved and changed a lot. With PowerShell version 5.0 we have now .NET class support! In every release you will feel yourself like a real developer 🙂

I was looking for the new features coming with version 5.0 and as always checking PowerShell MVP Trevor Sullivan`s blog. I came across with following Channel 9 video he published.

https://channel9.msdn.com/Shows/MsftPowerShell/Visual-Studio-2015-PowerShell-Tools-Overview

He is talking about PowerShell tools which is an extension for Visual Studio and allows you to develop PowerShell projects within Visual Studio. I strongly recommend above video if you are interested.

As a PowerShell fan, I always wanted to play with Visual Studio as I know that VS is much more powerful than PowerShell built-in ISE. VS provides integration with VS Online, Github (source control), Intellisense and Test Explorer.

Let me tell you how I develop my PowerShell scripts..

I don`t care about best practices or development cycles. I start to develop script from scratch. I try to follow a basic structure but most of the time I find myself lost in the hundreds of lines of codes. I also feel the pain of lack of change tracking, source control in ISE. In a typical week, I may add or change bunch of codes in my script and I`m trying to track my changes by creating manul version folders. Yes I know…It doesn`t work.

So wanted to give a chance Visual Studio and Github integration with PowerShell. Here is a quick requirements of this integration.

  • I installed PowerShell Tools extension for Visual Studio 2015.
  • I installed Github Extension for Visual Studio 2015.
  • Created a new account on Github and created a repository called PowerShell.
  • Logged in my Github account within Visual Studio.

1-300x138

Then followed steps mentioned on http://nokitel.im/index.php/2015/08/15/clone-existing-github-powershell-scripts-to-visual-studio-2015/.

At the end now I can easily create my scripts in Visual Studio using PowerShell Tools extension and then sync them to my Github repository.

For every change in my script, I comment and then commit/sync script to my repository so that easily can track versions.

Looking great!

PowerShell Function to create colorful menus

I was preparing a PowerShell demo for System Center Universe and decided to use nested menus in order to easily browse between different demo sections. This is how it looks like in action.

Couple of simple loops checks for the inputs and redirects you to the next level/menu.

Creating loops and logic was simple but drawing menus and lines was not easy as I expected. This is what I came up after couple of hours:

Write-Host “╔════════════════════════════════════════════════════════════════╗”-ForegroundColor Magenta
Write-Host “║” -f Magenta -nonewline;Write-Host “UCP Director – API Call – PowerShell Demo Script 1.0” -f Green -nonewline;Write-host “`0`0`0`0`0`0`0`0`0`0`0`0║” -ForegroundColor Magenta
Write-Host “╠════════════════════════════════════════════════════════════════╣”-ForegroundColor Magenta
Write-Host “║” -f Magenta -NoNewline;Write-Host “Please select the admin task you require:`0`0`0`0`0`0`0`0`0`0” -Fore Cyan -NoNewline;Write-host “`0`0`0`0`0`0`0`0`0`0`0`0`0║” -ForegroundColor Magenta
Write-Host “║`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0║” -f Magenta
Write-Host “║” -f Magenta -NoNewline;Write-Host “`t1. Provisioning” -f Yellow -NoNewline;write-host “`t`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0║” -Fore Magenta
Write-Host “║” -f Magenta -NoNewline;Write-Host “`t2. Monitoring” -f Yellow -NoNewline;write-host “`t`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0║” -Fore Magenta
Write-Host “╚════════════════════════════════════════════════════════════════╝`n”-ForegroundColor Magenta

Pretty ugly right? This is why I decided to create a consistent function so that everytime when I want to create a PowerShell menu I can use it.

Hopefully my Basel to London fligth delayed for 2 hours yesterday (!) and I had enough time to code it in airport.

Here is the function on Technet gallery:

https://gallery.technet.microsoft.com/scriptcenter/Create-colorful-PowerShell-8689c5b2

Usage is quite simple and in couple of seconds you can have menus like below:

Capture

Cheers!