Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Reading Notes #294

MagPi60-Cover

Suggestion of the week


Cloud


Programming


Miscellaneous



Reading Notes #284

IMG_20170609_092421Cloud

Programming

Miscellaneous




Reading Notes #281

AzureCLICloud


Programming


Databases


Miscellaneous



Reading Notes #261

gummibarchen-359950_960_720Suggestion of the week


Cloud


Programming


Miscellaneous




Need to Nuke an Azure Subscription?

(Ce billet en aussi disponible en français.)


I use very intensely my my.visualstudio (aka MSDN) Azure subscription, to create content for a demo or just to try new feature. So frequently I need to do some cleaning.

multi-resourceGroup-boom

Here a little script that will completely delete all resources of every resources group inside a specific subscription. To be able to execute this script you will need Azure PowerShell cmdlets.

The script asks you to login-in then list all the subscriptions that this account has access. Once you specify which one, it will list all the resource grouped by resource group. Then as a final warning, it will require one last validation before nuking everything.

Be careful.

#================================================================
#= Very dangerous interactive script that delete all rescources 
#= from all rescourcegroup in a specific subscription
#================================================================

# How to install and configure Azure PowerShell
# https://docs.microsoft.com/en-us/powershell/azureps-cmdlets-docs/

# Login
Login-AzureRmAccount 

# Get a list of all Azure subscript that the user can access
$allSubs = Get-AzureRmSubscription 

>$allSubs | Sort-Object Name | Format-Table -Property ame, SubscriptionId, State

$theSub = Read-Host "Enter the subscriptionId you want to clean"

Write-Host "You select the following subscription. (it will be display 15 sec.)" -ForegroundColor Cyan
Get-AzureRmSubscription -SubscriptionId $theSub | Select-AzureRmSubscription 

#Get all the resources groups
$allRG = Get-AzureRmResourceGroup

foreach ( $g in $allRG){
    Write-Host $g.ResourceGroupName -ForegroundColor Yellow 
    Write-Host "------------------------------------------------------`n" -ForegroundColor Yellow 
    $allResources = Find-AzureRmResource -ResourceGroupNameContains $g.ResourceGroupName
    if($allResources){
        $allResources | Format-Table -Property Name, ResourceName
    }else{
        Write-Host "-- empty--`n"
    } 
    Write-Host "`n`n------------------------------------------------------" -ForegroundColor Yellow 
}

$lastValidation = Read-Host "Do you wich to delete ALL the resouces previously listed? (YES/ NO)"
if($lastValidation.ToLower().Equals("yes")){
    foreach ( $g in $allRG){
        Write-Host "Deleting " $g.ResourceGroupName 
        Remove-AzureRmResourceGroup -Name $g.ResourceGroupName -Force -WhatIf
    }
}else{
    Write-Host "Aborded. Nothing was deleted." -ForegroundColor Cyan
}




The code is also available on Github: https://github.com/FBoucher/AzurePowerTools


Lessons learn while trying to deploy a Docker container in Azure

(Ce billet en aussi disponible en français.)


Since I saw Donovan Brown do his demo during the Connect(); // 2016 Keynote, I really want to have a taste of that left click to turn a project to Docker containers. So last Sunday I wake up early and armed with a big bowl of cafe latte start prepping my VM to try it. But as you could imagine, it didn't work on the first attempt, and that what I want to share to you.

DonovanBrown

Let's get started


I build a new VirtualBox virtual machine (VM) using an ISO of Windows 10, then install all the updates to get the anniversary edition. I afterward went to visualstudio.com to get the Visual Studio 2017 RC and install it with a few components: web, azure, etc. And next when looking for Docker for windows. Same here super easy just need to download and install the MSO from docker.com and voila... or not. Like specified in the Docker documentation the installer noticed that Hyper-V was not present in my environment and suggested installing it and reboot the machine. Until then, everything was going fine, but when Docker try to start, after the reboot, I got an error message:

Error creating machine: Error in driver during machine creation: This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory

However, the setting was set, as you can see in the screenshot.

VT-xSetting

After a short investigation, I found that VirtualBox was not supporting nested virtualization, yet. Well, let's try another virtualization platform then.

First Success


I created a new VM under VMware Player this time and repeated all the steps as before. After the reboot, the little white whale in the system didn't prompt any error... Was it working? Let's try to create a Nginx Hello-world container to check. And the answer was YES!

2016-11-22_19-00-45

Docker and Azure


Now let's get serious. It's time to do the left click on the project and add Docker Project Support. Then press F5 to try it locally.

ERROR: for mystuff Cannot create container for service mystuff: C: drive is not shared. Please share it in Docker for Windows Settings Encountered errors while bringing up the project..

I got too excited, and I had skipped some reading... It's written black on white in the documentation that you need to share some drive to make it work.

ShareDrice

After that it when smoothly and in few minutes, I got my website to run in a Docker container accessible via localhost:32768. Great! Now to get it available on Azure, I need to create a registry where all the images will be saved. To do that simply left click again on the project, and select Publish. The guided dialog will popup and help you to create and deploy your things. An interesting point is before clicking the "Create" button you will have the option to export your template as a json file, very useful. But for now click Create, then Publish.

DockerPublishing

After a moment you should have a new browser window that will popup with your App now deployed in Azure.

DockerOnline

Wow! That was really a great experience. It's definitely a very simple process to get started. I really appreciate the Docker for Windows and Kitematic user interface. Of course, all the command-line are still available, but now I also have another option for the day where I feel more for clicking instead of typing.

DockerTools

Let's build it and ship it, from any platform to the cloud!



Reading Notes #256

IMG_20161107_104028Cloud

Programming

Miscellaneous



Reading Notes #254

IMG_20161019_192029Cloud


Programming


Databases


Miscellaneous



Reading Notes #253

2016-10-17_09-17-05Suggestion of the week


Cloud


Programming


Databases



Reading Notes #252

ReadingNotesAppCloud

  • Azure Subscription Migration to CSP (Kirill Kotlyarenko) - Excellent post that explains the differences between the different types and how to migrate ... with a minimum of pain.
  • New lower Azure pricing (Takeshi Numoto) - Really good news more VMs types and lower prices.
  • Storing and using secrets in Azure (Bertrand Le Roy) - This p is great tutorial that explains all h steps to configure use the Azure Vault, when our secrets need more then sits in a config file.

Programming


Databases

  • Avoid ORDER BY in SQL Server views (Aaron Bertrand) - Sometimes we need workarounds to bend some services to our wishes, but we must keep in mind the real best practices.



Reading Notes #249

logicappSuggestion of the week


Cloud


Programming


Databases


Miscellaneous




Reading Notes #248

imageProgramming


Databases


Miscellaneous


Reading Notes #247

23Cloud


Programming


Miscellaneous

Reading Notes #246

IMG_20160826_115405Cloud


Programming


Databases


Miscellaneous


Reading Notes #240

Cloud


Programming


Data


Miscellaneous


Reading Notes #239

2016-07-04_05-54-55Cloud


Programming


Miscellaneous



Reading Notes #238

docker_ascii_artCloud


Programming


Miscellaneous

  • Back to my core - In this post, Darrel shares the beginning of a new adventure... Congradulation to you and looking forward to reading again from you. Microsoft gained a really good developer.


Reading Notes #236


WhyAzureCLISuggestion of the week


Cloud


Programming


Miscellaneous

  • Happiness is DevOps’ Cornerstone (Alexandre Brisebois) - Interesting post that asks a lot of questions... I would like to see some graph or pie chart about our answers.
  • 5 Habits that Help Code Quality (View all posts by Erik Dietrich) - Yet another post about how to code better, but this one is refreshing. It explains why the opposite would be harmful and also give us a training plan for better chance of success.
  • What’s in your highlights folder? (Marc Gagne) - Because life is not only mistakes and bad luck.Here good tips to help you giving some sunshine into your life when needed.

Reading Notes #235

ImaginationSuggestion of the week


Cloud


Reading Notes #233

mprofileCloud


Programming


Miscellaneous