Cloud and Datacenter Management Blog

Microsoft Hybrid Cloud blogsite about Management


Leave a comment

Microsoft Azure Resource Graph is a Powerful Tool #Azure #Cloud #AzOps #Kusto #PowerShell

Welcome to Azure Resource Graph

Azure Resource Graph is a service in Azure that is designed to extend Azure Resource Management by providing efficient and performance resource exploration with the ability to query at scale across a given set of subscriptions so that you can effectively govern your environment. Azure Resource Graph enables full visibility into your environments by providing high performance and powerful query capability across all your resources.

From here you can experience the power of Azure Resource Graph by doing it yourself.

Https://shell.azure.com

You can use Microsoft Azure Resource Graph with different language support like :

  • With Azure CLI
  • With PowerShell
  • With Kusto in Azure Resource Graph Explorer

Start here when you like to work with Microsoft Azure CLI

From here we are going further with Azure PowerShell and Azure Resource Graph in CloudShell.
Login to https://shell.azure.com

Type following command : Install-Module -Name Az.ResourceGraph

Type Y

Type the Following Command: Get-Command -Module ‘Az.ResourceGraph’ -CommandType ‘Cmdlet’

From here we can start with Search in Azure Resource Graph

The first step to understanding queries with Azure Resource Graph is a basic understanding of the Query Language. If you aren’t already familiar with Azure Data Explorer, it’s recommended to review the basics to understand how to compose requests for the resources you’re looking for.

Samples


Command : Search-AzGraph -Query ‘Resources | project name, type | limit 5’

Without the Limit 5 you get all of your resources.

Command: Search-AzGraph -Query ‘Resources | project name, type | limit 10 | order by name asc’

Command: Search-AzGraph -Query “Resources | summarize count()”


Command: Search-AzGraph -Query “Resources | project name, location, type| where type =~ ‘Microsoft.Compute/virtualMachines’ | order by name desc”

Command: Search-AzGraph -Query “Resources | where type =~ ‘Microsoft.Compute/virtualMachines’ | project name, properties.storageProfile.osDisk.osType | top 15 by name desc”


Command: Search-AzGraph -Query “Resources | where type contains ‘publicIPAdresses’ and isnotempty(properties.ipAddress) | project properties.ipAddress | limit 100”

Handy to see your External IP Addresses in Azure 😉


Command: Search-AzGraph -Query “Resources | where tags.environment=~’internal’ | project name”

To find tour Tagged Resources in Azure.


Microsoft Azure Resource Graph Explorer in the Portal.

Here you can make your kusto queries and save them for Colleagues by sharing them.

Sharing your Kusto queries

Resources
| where type =~ ‘microsoft.compute/virtualmachines’
| extend nics=array_length(properties.networkProfile.networkInterfaces)
| mv-expand nic=properties.networkProfile.networkInterfaces
| where nics == 1 or nic.properties.primary =~ ‘true’ or isempty(nic)
| project vmId = id, vmName = name, vmSize=tostring(properties.hardwareProfile.vmSize), nicId = tostring(nic.id)
| join kind=leftouter (
Resources
| where type =~ ‘microsoft.network/networkinterfaces’
| extend ipConfigsCount=array_length(properties.ipConfigurations)
| mv-expand ipconfig=properties.ipConfigurations
| where ipConfigsCount == 1 or ipconfig.properties.primary =~ ‘true’
| project nicId = id, publicIpId = tostring(ipconfig.properties.publicIPAddress.id))
on nicId
| project-away nicId1
| summarize by vmId, vmName, vmSize, nicId, publicIpId
| join kind=leftouter (
Resources
| where type =~ ‘microsoft.network/publicipaddresses’
| project publicIpId = id, publicIpAddress = properties.ipAddress)
on publicIpId
| project-away publicIpId1

More information about Microsoft Azure Resource Graph Explorer

Conclusion

When you are the Microsoft Azure Administrator, the Resource Graph Explorer can be really Powerful and fast to get the right information you are looking for. When you invest in the kusto queries your can save them and Share with your Colleagues to serve your business needs. Hope this is useful for you and happy Scripting with Kusto, Powershell or Azure CLI in the Cloud


Leave a comment

I Love #Microsoft Azure CloudShell in Visual Studio Code #VSC #Azure #Cloud

Azure Cloud Shell in VSC

Azure Cloud Shell is an interactive, browser-accessible shell for managing Azure resources. It provides the flexibility of choosing the shell experience that best suits the way you work. Linux users can opt for a Bash experience, while Windows users can opt for PowerShell

Here you find the Installation of Azure Cloud Shell in Visual Studio Code

As Easy as this 😉

More Technical information about Azure Cloud Shell on Microsoft Docs


Leave a comment

#MSBuild Azure Cloud Shell Announced – Rolling Out – Running in #Azure #DevOps #Cloud

COMMING SOON

ROLLING OUT at #MSBuild

One Click Configure

Azure Cloud Shell Running !
POWERSHELL Coming SOON

Here you find Microsoft Overview of Azure Cloud Shell (Preview)

#MSBuild


Leave a comment

Register for #Microsoft Azure Features with #Azure CLI 2.0

Login to Azure

Here you find how to install Microsoft Azure CLI 2.0

Go with your browser to https://aka.ms/devicelogin

Fill in your code

Your are logged in your Azure Subscription via Azure CLI 2.0

With Microsoft Azure CLI 2.0 Feature option you can see the Microsoft Azure Features available to register :

Azure Feature list

You see the Microsoft Azure Preview (Private) Features also 😉

Usage: feature register [options] <providerName> <featureName>

Lot of success with Registering your Azure Feature !

Here you find more information about Microsoft Azure CLI 2.0


Leave a comment

#Microsoft Azure CLI 2.0 in Ubuntu #Bash of #Windows 10 #Linux #Azure #DevOps

Azure CLI 2.0 in Bash

If you use Ubuntu Bash in Windows 10 and like to work with Microsoft Azure Cloud Services you can install Azure CLI 2.0 for Linux

For Debian/Ubuntu based systems, you can install Azure CLI 2.0 via apt-get. 

    1. Modify your sources list.
      • 32-bit system
        Copy
        bash
        echo "deb https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
             sudo tee /etc/apt/sources.list.d/azure-cli.list
        
      • 64-bit system
        Copy
        bash
        echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
             sudo tee /etc/apt/sources.list.d/azure-cli.list
        
    2. Run the following sudo commands:
      Copy
      bash
      sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893
      sudo apt-get install apt-transport-https
      sudo apt-get update && sudo apt-get install azure-cli
      

 

When you install with apt-get, az component isn’t supported. To update the CLI, use the following commands: 

Copy
bash
sudo apt-get update && sudo apt-get install azure-cli


Leave a comment

#Microsoft Azure CLI 2.0 Command Reference from A – Z is Awesome ! #Azure #AzureStack #DevOps

Microsoft Azure CLI 2.0 from a Docker Container

CMD Azure VM -h

Here you find the Complete Microsoft Azure Command Line Interface 2.0 (CLI) Reference Guide and use -h option in the CLI


Leave a comment

Install #Azure CLI 2.0 and Run Script for VM with Operations Management Suite Agent #MSOMS

Download Python for Windows here

Be sure to install the Pip component when you install Python. After the install completes, add Python to your PATH environment variable
(the installer will prompt you).

The Azure CLI 2.0 is Azure’s new command-line experience for managing Azure resources. It can be used on macOS, Linux, and Windows.

Azure CLI 2.0 is optimized for managing and administering Azure resources from the command line, and for building automation scripts that work against the Azure Resource Manager.

Open Command Prompt and type : python –version

To install Azure CLI you have to type the following command :
pip install –user azure-cli

Installing Azure CLI 2.0

Done.
Type Azure

With Microsoft Azure CLI 2.0 scripts you can deploy complete solutions, like this example for a Virtual Machine with Microsoft OMS agent active :

Sample script

#!/bin/sh

# Update for your admin password
AdminPassword=ChangeYourAdminPassword1

# OMS Id and OMS key.
omsid=<Replace with your OMS Id>
omskey=<Replace with your OMS key>

# Create a resource group.
az group create --name myResourceGroup --location westeurope

# Create a virtual machine. 
az vm create \
    --resource-group myResourceGroup \
    --name myVM \
    --image win2016datacenter \
    --admin-username azureuser \
    --admin-password $AdminPassword 

# Install and configure the OMS agent.
az vm extension set \
  --resource-group myResourceGroup \
  --vm-name myVM --name MicrosoftMonitoringAgent \
  --publisher Microsoft.EnterpriseCloud.Monitoring \
  --version 1.0 --protected-settings '{"workspaceKey": "'"$omskey"'"}' \
  --settings '{"workspaceId": "'"$omsid"'"}'


Leave a comment

Continuous Delivery to Microsoft #Azure with #Docker #Container for #DevOps #Dev #Code #Cloud

To make it easy for you to deploy your application to Azure we’ve built a container that has the AzureCLI installed. We will set up a simple example showing you how to configure any deployment to Azure. If you don’t have Docker yet you can get it here

With command Docker pull microsoft/azure-cli you get the latest Container

With the command docker run -it microsoft/azure-cli you will start the Container

Now you have the latest Azure CLI in a Docker Container

From inside the Microsoft Docker Container we will make a connection to a Azure subscription, if you don’t have a Microsoft Azure subscription you
can get your free Azure trail subscription here

My Microsoft Docker Container is running.

with command Azure Login you will start the login process

Copy the url https://aka.ms/devicelogin in your browser :

Copy your code from the container login into the Device login

Click on Continue for Microsoft Azure Cross-Platform CLI Login

Login with your Microsoft Azure account of your subscription

Done !

The Microsoft Docker Container with the latest Azure CLI is connected with your Azure Subscription 😉

From here you can do a Continuous Delivery to Microsoft Azure with Docker and #Code.

With the Command Azure Lab you see I can manage my Azure Dev/Test LAB from my Docker Container 😉

Here you see my Container01 in JamesTestLAB in Azure

With the Command Azure vm start we run the Azure Container01

Now the Azure Container01 is running and started from a Microsoft Docker Container with Azure CLI

Get started with Azure CLI 2.0 Technical Docs

Have a look at CodeShip here to make it your self easy for continuous delivery on Microsoft Azure Cloud