Category Archives: azure

Deploy a new IIS Web Site with Azure DevOps Pipelines

I was experimenting with deploying a completely new Web Site to a machine with a brand new IIS installation to see what are the required parameter to do a basic deployment.
I share here my findings.

Continue reading Deploy a new IIS Web Site with Azure DevOps Pipelines

Azure DevOps – Undelete a Release Pipeline

A few months ago I deleted a folder with inside a release definition.
My friend Alessandro Alpi helped me a lot pointing me to this msdn article.
With the PowerShell script that you find following the link you can restore a deleted release pipeline but only within 4 weeks of the deletion.

Continue reading Azure DevOps – Undelete a Release Pipeline

VSTS for beginners: release your web-app to Azure

In the previous post of this series dedicated to VSTS we talked about continuous integration. Now we’ll talk about publishing our Web-App hosted on Azure with the release management tools provided by VSTS. With this kind of tools we can deploy the latest version of our web-app to Azure in complete automation removing manual procedures and human errors. The setup of Azure will be covered in another blog post.

 

Continue reading VSTS for beginners: release your web-app to Azure

Azure PowerShell Start Virtual Machine

This is the script I use to start virtual machines in our cloud environment. I write it down here for archive and sharing purposes.

1.png

It is based on the Azure RunAs automation account.

The only thing thing you need to do is to schedule this script daily.


<#
    .DESCRIPTION
        Turns of virtual machines only office days.

    .NOTES
        AUTHOR: Michele Ferracin
#>


# No Sunday, no Saturday.
$wd = (Get-Date).DayOfWeek

if ($wd -eq "Sunday" -or $wd -eq "Saturday") {
 exit 0;
}

$connectionName = "AzureRunAsConnection"
try
{
    # Get the connection "AzureRunAsConnection "
    $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName        

    "Logging in to Azure..."
    Add-AzureRmAccount `
        -ServicePrincipal `
        -TenantId $servicePrincipalConnection.TenantId `
        -ApplicationId $servicePrincipalConnection.ApplicationId `
        -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint 
}
catch {
    if (!$servicePrincipalConnection)
    {
        $ErrorMessage = "Connection $connectionName not found."
        throw $ErrorMessage
    } else{
        Write-Error -Message $_.Exception
        throw $_.Exception
    }
}

Start-AzureRmVM -Name "YourVM1" -ResourceGroupName "YourResourceGroup"

Start-AzureRmVM -Name "YourVM2" -ResourceGroupName "YourResourceGroup"