Microsoft Azure Portal App for Windows, iPhone and Android

Microsoft has released a preview version of the Azure Portal app for Windows. I used it for some time now and it works quite well. You get rid of the browser, while the functionalities remain the same as in the Azure portal.

Download for Windows: https://portal.azure.com/App/Download

When on the go, I recommend the Microsoft Azure app for iOS or Android.

App Store Download: https://itunes.apple.com/app/microsoft-azure/id1219013620?ls=1&mt=8

Google Play Download: https://play.google.com/store/apps/details?id=com.microsoft.azure

Azure Serverless Architectures: host a static website in Azure Storage

Azure Storage v2 accounts allow you to serve static content (HTML, CSS, JavaScript, and image files) directly from a storage container named $web. Taking advantage of hosting in Azure Storage allows you to use serverless architectures including Azure Functions and other PaaS services.

When you enable static website hosting on your storage account, you select the name of your default file and optionally provide a path to a custom 404 page. As the feature is enabled, a container named $web is created if it doesn’t already exist.

You can enable static website from the Azure CLI using this script:

#Parameters

param(
    [Parameter(Mandatory=$True, HelpMessage="Please specify the storage account name")][String]$Storage_Name_Web,
    [Parameter(Mandatory=$True, HelpMessage="Please specify the subscription ID")][String]$subscriptionId
)

#Connect to Azure
Connect-AzAccount

#Change the context to the Azure subscription
Set-AzContext -Subscription $subscriptionId

# Enable static website
az account set --subscription $subscriptionId
az storage blob service-properties update --account-name $Storage_Name_Web --static-website --404-document "404.html" --index-document "index.html"

Or you can enable static website from the Azure Portal:

To test the website, you can upload a sample html file to the blob storage. From the storage account, go to the blobs section and expand the $web container.

Upload a sample html file with the name “index.html”.

In my case the index.html contains a link to a picture:

<html>
  <body>
    <img src="blog.bmp">
  </body>
</html>

Now when you browse the blob storage endpoint, in my case
https://ranariwebstorage.z6.web.core.windows.net , you get the index.html:

Create Azure Cosmos Databases programmatically using ARM templates and PowerShell

I have recently deployed tens of Azure resources programmatically. While most of the Azure resources and settings you can define in the ARM templates in JSON format, there are scenarios where you need to benefit from the power of PowerShell and the Azure CLI.

In this article I will demonstrate how to deploy an Azure Cosmos DB Account using an ARM template and then create the databases and collections using PowerShell.

To get the Azure templates for Visual Studio, install the Azure development SDK:

Create in Visual Studio a new project from type Azure Resource Group:

Edit the file azuredeploy.json like this:

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"environmentName": {
"type": "string",
"defaultValue": "ranari"
}
},
"variables": {},
"resources": [
{
"apiVersion": "2015-04-08",
"name": "[concat(parameters('environmentName'),'mongodb')]",
"type": "Microsoft.DocumentDB/databaseAccounts",
"kind": "MongoDB",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"ipRangeFilter": "",
"enableAutomaticFailover": false,
"enableMultipleWriteLocations": false,
"isVirtualNetworkFilterEnabled": false,
"virtualNetworkRules": [],
"databaseAccountOfferType": "Standard",
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
"maxStalenessPrefix": 100
},
"locations": [
{
"locationName": "[resourceGroup().location]",
"failoverPriority": 0
}
],
"capabilities": []
},
"dependsOn": [],
"tags": {}
}
],
"outputs": {}
}

Deploy the solution by following these steps:

Browse the Azure site and observe that the Azure Cosmos DB Account has been created:

At this point the Azure Cosmos DB account is empty. To add a database and collection, run following PowerShell script:

#####################################################

#Parameters & variables

param(
[Parameter(Mandatory=$true)][String]$environmentName,
[Parameter(Mandatory=$false)][String]$subscriptionId = "e9c6149c-f5f6-44c7-aa8b-b8d2fa7f6140"
)

$resourceGroup = $environmentName.ToLower() + "-databases"
$mongoDBAccount = $environmentName.ToLower() + "mongodb"
$mongoDBdatabase = $environmentName.ToLower() + "-cars"

$mongoDBdatabaseCollections=@("VW",
"BMW",
"Mercedes",
"Audi",
"Skoda",
"Renault",
"Ford")

#####################################################

#Connect to Azure
Connect-AzAccount
az account set --subscription $subscriptionId

#####################################################
#Create databases and collections

az cosmosdb database create --resource-group-name $resourceGroup --db-name $mongoDBdatabase --name $mongoDBAccount

foreach($collection in $mongoDBdatabaseCollections)
{
az cosmosdb collection create --resource-group-name $resourceGroup --name $mongoDBAccount --db-name $mongoDBdatabase --collection-name $collection --throughput 400
}
#####################################################

Now check in Azure that the database and collection were successfully created: