SlideShare uma empresa Scribd logo
1 de 48
GettingfasteranswersinAzureResourceManager
Getting faster answers in
Azure Resource Manager
Stephane Lapointe
Theeasiest,mostefficientwaytomanageAzuresubscriptionsatscale
@s_lapointe
Microsoft Azure MVP
Cloud Solutions Architect
• Azure Resource Manager
• Azure Resource Browser
• Azure Resource Explorer
• Azure Resource Graph
• Azure Resource Changes
Agenda
GettingfasteranswersinAzureResourceManager
What Is Azure Resource Manager (ARM)
GettingfasteranswersinAzureResourceManager
API ENDPOINT (MANAGEMENT.AZURE.COM)
ACTIVITY LOGS, ACCESS CONTROL, POLICY, LOCKS,
TEMPLATE ENGINE, DEPLOYMENTS, RESOURCE GROUP
what is azure resource manager?
PROVIDER CONTRACT (RPC)
RESOURCE
PROVIDERS
Assignable
scopes • Management Groups
• Subscriptions
• Resource Groups
• Resources
/providers/Microsoft.Management/managementGroups/gsoft-group//subscriptions/79a9ef18-743b-42b7-ba0a-4414ff9ab4e1/subscriptions/79a9ef18-743b-42b7-ba0a-4414ff9ab4e1/resourceGroups/ov-prod-temp/subscriptions/79a9ef18-743b-42b7-ba0a-4414ff9ab4e1/resourceGroups/ov-prod-temp
/providers/Microsoft.Web/sites/ov-prod-as-web-9999999999999
GettingfasteranswersinAzureResourceManager
Azure Resources in the portal
GettingfasteranswersinAzureResourceManager
Theeasiest,mostefficientwaytomanageAzuresubscriptionsatscale
Azure Resource Explorer
Multiple subscriptions?
GettingfasteranswersinAzureResourceManager
Typical script Lookup for all resources of a specific type
• Get subscription list
• Change context for each subscription
• Query
$ErrorActionPreference = 'Stop'
$subcriptions = Get-AzSubscription
$results = $subcriptions | ForEach-Object {
$_ | Set-AzContext | Out-Null
Write-Host ('Scanning subscription {0}' -f $_.Name) -ForegroundColor Green
Get-AzResource -ResourceType 'Microsoft.Storage/storageAccounts'
}
#do something with $results
$results
GettingfasteranswersinAzureResourceManager
Say hello to Azure Resource Graph
GettingfasteranswersinAzureResourceManager
provide efficient and performant
resource exploration
ability to query at scale across a
given set of subscriptions
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
Features
• Blazing fast
• Visibility across your cloud resources
• Powerful querying to gain deeper insights
• Rich aggregation and parsing of granular properties
• Tracking of changes made to resource properties
(preview)
• Support Azure Delegated Resource Management
(Azure Lighthouse)
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
Queries are read only
• Subset of the operators and functions of Azure Data
Explorer
https://docs.microsoft.com/en-
us/azure/governance/resource-graph/concepts/query-
language
Refresh frequencies
• ~15 sec at change
• Regular full scan
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
Restrictions and nice to know
• Not all types are supported
see the schema browser in the portal or
https://docs.microsoft.com/en-ca/azure/azure-
resource-manager/complete-mode-deletion
• Need to implement a paging mechanism when you
have a large result set or more than 1000
subscriptions
GettingfasteranswersinAzureResourceManager
Query syntax and basics
GettingfasteranswersinAzureResourceManager
Query language is based on the Kusto
query language used by Azure Data
Explorer.
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
String operators
https://docs.microsoft.com/en-
us/azure/kusto/query/datatypes-string-operators
Operator Description
Case-
Sensitive
Example
(yields true)
== Equals Yes "aBc" == "aBc"
!= Not equals Yes "abc" != "ABC"
=~ Equals No "abc" =~ "ABC"
!~ Not equals No "aBc" !~ "xyz"
contains RHS occurs as
a subsequence
of LHS
No "FabriKam"
contains "BRik"
matches
regex
LHS contains a
match for RHS
Yes "Fabrikam"
matches regex
"b.*k"
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
where operator
Filters to the subset of rows that satisfy a predicate.
https://docs.microsoft.com/en-
us/azure/kusto/query/whereoperator
// all web sites
Resources
| where type =~ "Microsoft.Web/sites"
// all resources not global or canada, excluding networkwatchers and
Microsoft insights types
Resources
| where location !contains 'global' and location !contains 'canada'
| where type !~ 'Microsoft.Network/networkwatchers'
| where type !startswith 'microsoft.insights/'
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
project operator
Select the columns to include, rename or drop, and
insert new computed columns.
https://docs.microsoft.com/en-
us/azure/kusto/query/projectoperator
// all web sites, returning only subscriptionId, resourceGroup and
name
Resources
| where type =~ "Microsoft.Web/sites"
| project subscriptionId, resourceGroup, name
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
extend operator
Create calculated columns and append them to the
result set.
https://docs.microsoft.com/en-
us/azure/kusto/query/extendoperator
// all web certificates that expires within 90 days
Resources
| where type =~ "Microsoft.Web/certificates" and
properties.expirationDate <= now(90d)
| extend expirationDate = tostring(properties.expirationDate)
| project subscriptionId, resourceGroup, name, location,
thumbprint = properties.thumbprint, expirationDate,
friendlyName = properties.friendlyName, subjectName =
properties.subjectName
| sort by expirationDate asc
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
project-away operator
Select what columns in the input to exclude from the
output.
https://docs.microsoft.com/en-
us/azure/kusto/query/projectawayoperator
// all web sites returning all information but properties (bag)
and managedby
Resources
| where type =~ "Microsoft.Web/sites"
| project-away properties, managedBy
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
summarize operator
Produces a table that aggregates the content of the
input table.
https://docs.microsoft.com/en-
us/azure/kusto/query/summarizeoperator
// count of all resources by subscription and location
Resources
| summarize count() by subscriptionId, location
// count of storage accounts with HTTP enabled by location
Resources
| where type =~ 'Microsoft.Storage/storageAccounts'
| where properties.supportsHttpsTrafficOnly == 'false'
| summarize count = count() by location
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
Querying over tags
Use tags.name or tags['name'] construct to query
tags on resources.
https://docs.microsoft.com/en-
us/azure/kusto/query/extendoperator
// return all resources with the value 'production' in the
'environment' tag
Resources
| where tags['environment'] =~ 'production'
| project subscriptionId, resourceGroup, name, tags
// return all resources where the tag 'environment' is not present
Resources
| where isempty(tags['environment'])
| project subscriptionId, resourceGroup, name, tags
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
Tables
https://docs.microsoft.com/en-
us/azure/governance/resource-graph/concepts/query-
language#resource-graph-tables
Resource Graph tables Description
Resources The default table if none defined in the query. Most
Resource Manager resource types and properties
are here.
ResourceContainers Includes subscription
(Microsoft.Resources/subscriptions) and resource
group
(Microsoft.Resources/subscriptions/resourcegroups)
resource types and data.
AlertsManagementResources Includes
resources related to Microsoft.AlertsManagement.
SecurityResources Includes resources related to Microsoft.Security.
GettingfasteranswersinAzureResourceManager
Azure
Resource Graph
Join operator
https://docs.microsoft.com/en-
us/azure/kusto/query/joinoperator
// 1 random result joining ResourceContainers table to include
subscriptionName to result set
Resources
| join (ResourceContainers | where
type=~'Microsoft.Resources/Subscriptions' | project
subscriptionName=name, subscriptionId) on subscriptionId
| project type, name, subscriptionId, subscriptionName
| limit 1
GettingfasteranswersinAzureResourceManager
Demo: ARG in the portal
GettingfasteranswersinAzureResourceManager
ARG outside the portal
GettingfasteranswersinAzureResourceManager
PowerShell How to use Azure Resource Graph in PowerShell
• Install Az modules
• Install Az.ResourceGraph module
• Use Search-AzGraph cmdlet
$pageSize = 100
$iteration = 0
$searchParams = @{
Query = 'where type =~ "Microsoft.Network/applicationGateways" | project id, subscriptionId, subscriptionDisplayName
, resourceGroup, name, sslCertificates = properties.sslCertificates | order by id'
First = $pageSize
Include = 'displayNames'
}
$results = do {
$iteration += 1
Write-Verbose "Iteration #$iteration"
$pageResults = Search-AzGraph @searchParams
$searchParams.Skip += $pageResults.Count
$pageResults
Write-Verbose $pageResults.Count
} while ($pageResults.Count -eq $pageSize)
GettingfasteranswersinAzureResourceManager
Azure CLI How to use Azure Resource Graph in Azure CLI
• Install Azure CLI
• Install resource-graph extension
• Use az graph query
// Request a subset of results, skipping 20 items and getting the next 10.
az graph query -q "where type =~ "Microsoft.Compute" | project name, tags" --first 10 --
skip 20
// Choose subscriptions to query.
az graph query -q "where type =~ "Microsoft.Compute" | project name, tags" –subscriptions
11111111-1111-1111-1111-111111111111, 22222222-2222-2222-2222-222222222222
GettingfasteranswersinAzureResourceManager
Azure Resource Changes
GettingfasteranswersinAzureResourceManager
Resource
changes
14 days of change history
• Find when changes were detected on an Azure
Resource Manager property
• For each resource change, see property change
details
• See a full comparison of the resource before and
after the detected change
GettingfasteranswersinAzureResourceManager
Resource
changes
REST API
• Sample POST call to return list of changes for a
resource
GettingfasteranswersinAzureResourceManager
POST https://management.azure.com/providers/Microsoft.ResourceGraph/resourceChanges?api-
version=2018-09-01-preview
{
"resourceId":
"/subscriptions/{subscriptionId}/resourceGroups/MyResourceGroup/providers/Microsoft.Stora
ge/storageAccounts/mystorageaccount",
"interval": {
"start": "2020-02-01T00:00:00.000Z",
"end": "2020-02-15T00:00:00.000Z"
},
"fetchPropertyChanges": false
}
Demo: Resource changes in
Resource Explorer
GettingfasteranswersinAzureResourceManager
Resources
Azure Resource Explorer
Azure Resource Explorer (RAW)
Azure Resource Graph documentation
Azure Resource Graph quickstart queries
Azure Resource Changes
Azure CLI
Azure PowerShell
GettingfasteranswersinAzureResourceManager
Questions?
GettingfasteranswersinAzureResourceManager

Mais conteúdo relacionado

Mais de MSDEVMTL

Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcoreMSDEVMTL
 
Groupe Excel et Power BI - Rencontre du 25 septembre 2018
Groupe Excel et Power BI  - Rencontre du 25 septembre 2018Groupe Excel et Power BI  - Rencontre du 25 septembre 2018
Groupe Excel et Power BI - Rencontre du 25 septembre 2018MSDEVMTL
 
Api gateway
Api gatewayApi gateway
Api gatewayMSDEVMTL
 
Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcoreMSDEVMTL
 
Stephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environmentsStephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environmentsMSDEVMTL
 
Eric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts AzureEric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts AzureMSDEVMTL
 
Data science presentation
Data science presentationData science presentation
Data science presentationMSDEVMTL
 
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...MSDEVMTL
 
Open id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api coreOpen id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api coreMSDEVMTL
 
Yoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analyticsYoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analyticsMSDEVMTL
 
CAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling AverageCAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling AverageMSDEVMTL
 
CAE: etude de cas
CAE: etude de casCAE: etude de cas
CAE: etude de casMSDEVMTL
 
Dan Edwards : Data visualization best practices with Power BI
Dan Edwards : Data visualization best practices with Power BIDan Edwards : Data visualization best practices with Power BI
Dan Edwards : Data visualization best practices with Power BIMSDEVMTL
 
Entity framework core 2 vs micro orm performances
Entity framework core 2 vs micro orm performancesEntity framework core 2 vs micro orm performances
Entity framework core 2 vs micro orm performancesMSDEVMTL
 
Groupe Excel + Power BI: Microsoft Flow
Groupe Excel + Power BI: Microsoft FlowGroupe Excel + Power BI: Microsoft Flow
Groupe Excel + Power BI: Microsoft FlowMSDEVMTL
 
Gessie Exantus: etude de cas Custom Map
Gessie Exantus: etude de cas Custom MapGessie Exantus: etude de cas Custom Map
Gessie Exantus: etude de cas Custom MapMSDEVMTL
 
Robert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans ExcelRobert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans ExcelMSDEVMTL
 
Guy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBIGuy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBIMSDEVMTL
 
Les micro orm, alternatives à entity framework
Les micro orm, alternatives à entity frameworkLes micro orm, alternatives à entity framework
Les micro orm, alternatives à entity frameworkMSDEVMTL
 
Cathy Monier: Power Query et Power BI
Cathy Monier: Power Query et Power BICathy Monier: Power Query et Power BI
Cathy Monier: Power Query et Power BIMSDEVMTL
 

Mais de MSDEVMTL (20)

Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcore
 
Groupe Excel et Power BI - Rencontre du 25 septembre 2018
Groupe Excel et Power BI  - Rencontre du 25 septembre 2018Groupe Excel et Power BI  - Rencontre du 25 septembre 2018
Groupe Excel et Power BI - Rencontre du 25 septembre 2018
 
Api gateway
Api gatewayApi gateway
Api gateway
 
Common features in webapi aspnetcore
Common features in webapi aspnetcoreCommon features in webapi aspnetcore
Common features in webapi aspnetcore
 
Stephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environmentsStephane Lapointe: Governance in Azure, keep control of your environments
Stephane Lapointe: Governance in Azure, keep control of your environments
 
Eric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts AzureEric Routhier: Garder le contrôle sur vos coûts Azure
Eric Routhier: Garder le contrôle sur vos coûts Azure
 
Data science presentation
Data science presentationData science presentation
Data science presentation
 
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
Michel Ouellette + Gabriel Lainesse: Process Automation & Data Analytics at S...
 
Open id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api coreOpen id connect, azure ad, angular 5, web api core
Open id connect, azure ad, angular 5, web api core
 
Yoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analyticsYoann Clombe : Fail fast, iterate quickly with power bi and google analytics
Yoann Clombe : Fail fast, iterate quickly with power bi and google analytics
 
CAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling AverageCAE: etude de cas - Rolling Average
CAE: etude de cas - Rolling Average
 
CAE: etude de cas
CAE: etude de casCAE: etude de cas
CAE: etude de cas
 
Dan Edwards : Data visualization best practices with Power BI
Dan Edwards : Data visualization best practices with Power BIDan Edwards : Data visualization best practices with Power BI
Dan Edwards : Data visualization best practices with Power BI
 
Entity framework core 2 vs micro orm performances
Entity framework core 2 vs micro orm performancesEntity framework core 2 vs micro orm performances
Entity framework core 2 vs micro orm performances
 
Groupe Excel + Power BI: Microsoft Flow
Groupe Excel + Power BI: Microsoft FlowGroupe Excel + Power BI: Microsoft Flow
Groupe Excel + Power BI: Microsoft Flow
 
Gessie Exantus: etude de cas Custom Map
Gessie Exantus: etude de cas Custom MapGessie Exantus: etude de cas Custom Map
Gessie Exantus: etude de cas Custom Map
 
Robert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans ExcelRobert Luong: Analyse prédictive dans Excel
Robert Luong: Analyse prédictive dans Excel
 
Guy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBIGuy Barrette: Afficher des données en temps réel dans PowerBI
Guy Barrette: Afficher des données en temps réel dans PowerBI
 
Les micro orm, alternatives à entity framework
Les micro orm, alternatives à entity frameworkLes micro orm, alternatives à entity framework
Les micro orm, alternatives à entity framework
 
Cathy Monier: Power Query et Power BI
Cathy Monier: Power Query et Power BICathy Monier: Power Query et Power BI
Cathy Monier: Power Query et Power BI
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Getting faster answers in Azure Resource Manager

  • 3. • Azure Resource Manager • Azure Resource Browser • Azure Resource Explorer • Azure Resource Graph • Azure Resource Changes Agenda GettingfasteranswersinAzureResourceManager
  • 4. What Is Azure Resource Manager (ARM) GettingfasteranswersinAzureResourceManager
  • 5. API ENDPOINT (MANAGEMENT.AZURE.COM) ACTIVITY LOGS, ACCESS CONTROL, POLICY, LOCKS, TEMPLATE ENGINE, DEPLOYMENTS, RESOURCE GROUP what is azure resource manager? PROVIDER CONTRACT (RPC) RESOURCE PROVIDERS
  • 6. Assignable scopes • Management Groups • Subscriptions • Resource Groups • Resources /providers/Microsoft.Management/managementGroups/gsoft-group//subscriptions/79a9ef18-743b-42b7-ba0a-4414ff9ab4e1/subscriptions/79a9ef18-743b-42b7-ba0a-4414ff9ab4e1/resourceGroups/ov-prod-temp/subscriptions/79a9ef18-743b-42b7-ba0a-4414ff9ab4e1/resourceGroups/ov-prod-temp /providers/Microsoft.Web/sites/ov-prod-as-web-9999999999999 GettingfasteranswersinAzureResourceManager
  • 7. Azure Resources in the portal GettingfasteranswersinAzureResourceManager
  • 8.
  • 9.
  • 10.
  • 11.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 20. Typical script Lookup for all resources of a specific type • Get subscription list • Change context for each subscription • Query $ErrorActionPreference = 'Stop' $subcriptions = Get-AzSubscription $results = $subcriptions | ForEach-Object { $_ | Set-AzContext | Out-Null Write-Host ('Scanning subscription {0}' -f $_.Name) -ForegroundColor Green Get-AzResource -ResourceType 'Microsoft.Storage/storageAccounts' } #do something with $results $results GettingfasteranswersinAzureResourceManager
  • 21. Say hello to Azure Resource Graph GettingfasteranswersinAzureResourceManager
  • 22. provide efficient and performant resource exploration ability to query at scale across a given set of subscriptions GettingfasteranswersinAzureResourceManager
  • 23. Azure Resource Graph Features • Blazing fast • Visibility across your cloud resources • Powerful querying to gain deeper insights • Rich aggregation and parsing of granular properties • Tracking of changes made to resource properties (preview) • Support Azure Delegated Resource Management (Azure Lighthouse) GettingfasteranswersinAzureResourceManager
  • 24. Azure Resource Graph Queries are read only • Subset of the operators and functions of Azure Data Explorer https://docs.microsoft.com/en- us/azure/governance/resource-graph/concepts/query- language Refresh frequencies • ~15 sec at change • Regular full scan GettingfasteranswersinAzureResourceManager
  • 25. Azure Resource Graph Restrictions and nice to know • Not all types are supported see the schema browser in the portal or https://docs.microsoft.com/en-ca/azure/azure- resource-manager/complete-mode-deletion • Need to implement a paging mechanism when you have a large result set or more than 1000 subscriptions GettingfasteranswersinAzureResourceManager
  • 26. Query syntax and basics GettingfasteranswersinAzureResourceManager
  • 27. Query language is based on the Kusto query language used by Azure Data Explorer. GettingfasteranswersinAzureResourceManager
  • 28. Azure Resource Graph String operators https://docs.microsoft.com/en- us/azure/kusto/query/datatypes-string-operators Operator Description Case- Sensitive Example (yields true) == Equals Yes "aBc" == "aBc" != Not equals Yes "abc" != "ABC" =~ Equals No "abc" =~ "ABC" !~ Not equals No "aBc" !~ "xyz" contains RHS occurs as a subsequence of LHS No "FabriKam" contains "BRik" matches regex LHS contains a match for RHS Yes "Fabrikam" matches regex "b.*k" GettingfasteranswersinAzureResourceManager
  • 29. Azure Resource Graph where operator Filters to the subset of rows that satisfy a predicate. https://docs.microsoft.com/en- us/azure/kusto/query/whereoperator // all web sites Resources | where type =~ "Microsoft.Web/sites" // all resources not global or canada, excluding networkwatchers and Microsoft insights types Resources | where location !contains 'global' and location !contains 'canada' | where type !~ 'Microsoft.Network/networkwatchers' | where type !startswith 'microsoft.insights/' GettingfasteranswersinAzureResourceManager
  • 30. Azure Resource Graph project operator Select the columns to include, rename or drop, and insert new computed columns. https://docs.microsoft.com/en- us/azure/kusto/query/projectoperator // all web sites, returning only subscriptionId, resourceGroup and name Resources | where type =~ "Microsoft.Web/sites" | project subscriptionId, resourceGroup, name GettingfasteranswersinAzureResourceManager
  • 31. Azure Resource Graph extend operator Create calculated columns and append them to the result set. https://docs.microsoft.com/en- us/azure/kusto/query/extendoperator // all web certificates that expires within 90 days Resources | where type =~ "Microsoft.Web/certificates" and properties.expirationDate <= now(90d) | extend expirationDate = tostring(properties.expirationDate) | project subscriptionId, resourceGroup, name, location, thumbprint = properties.thumbprint, expirationDate, friendlyName = properties.friendlyName, subjectName = properties.subjectName | sort by expirationDate asc GettingfasteranswersinAzureResourceManager
  • 32. Azure Resource Graph project-away operator Select what columns in the input to exclude from the output. https://docs.microsoft.com/en- us/azure/kusto/query/projectawayoperator // all web sites returning all information but properties (bag) and managedby Resources | where type =~ "Microsoft.Web/sites" | project-away properties, managedBy GettingfasteranswersinAzureResourceManager
  • 33. Azure Resource Graph summarize operator Produces a table that aggregates the content of the input table. https://docs.microsoft.com/en- us/azure/kusto/query/summarizeoperator // count of all resources by subscription and location Resources | summarize count() by subscriptionId, location // count of storage accounts with HTTP enabled by location Resources | where type =~ 'Microsoft.Storage/storageAccounts' | where properties.supportsHttpsTrafficOnly == 'false' | summarize count = count() by location GettingfasteranswersinAzureResourceManager
  • 34. Azure Resource Graph Querying over tags Use tags.name or tags['name'] construct to query tags on resources. https://docs.microsoft.com/en- us/azure/kusto/query/extendoperator // return all resources with the value 'production' in the 'environment' tag Resources | where tags['environment'] =~ 'production' | project subscriptionId, resourceGroup, name, tags // return all resources where the tag 'environment' is not present Resources | where isempty(tags['environment']) | project subscriptionId, resourceGroup, name, tags GettingfasteranswersinAzureResourceManager
  • 35. Azure Resource Graph Tables https://docs.microsoft.com/en- us/azure/governance/resource-graph/concepts/query- language#resource-graph-tables Resource Graph tables Description Resources The default table if none defined in the query. Most Resource Manager resource types and properties are here. ResourceContainers Includes subscription (Microsoft.Resources/subscriptions) and resource group (Microsoft.Resources/subscriptions/resourcegroups) resource types and data. AlertsManagementResources Includes resources related to Microsoft.AlertsManagement. SecurityResources Includes resources related to Microsoft.Security. GettingfasteranswersinAzureResourceManager
  • 36. Azure Resource Graph Join operator https://docs.microsoft.com/en- us/azure/kusto/query/joinoperator // 1 random result joining ResourceContainers table to include subscriptionName to result set Resources | join (ResourceContainers | where type=~'Microsoft.Resources/Subscriptions' | project subscriptionName=name, subscriptionId) on subscriptionId | project type, name, subscriptionId, subscriptionName | limit 1 GettingfasteranswersinAzureResourceManager
  • 37. Demo: ARG in the portal GettingfasteranswersinAzureResourceManager
  • 38. ARG outside the portal GettingfasteranswersinAzureResourceManager
  • 39. PowerShell How to use Azure Resource Graph in PowerShell • Install Az modules • Install Az.ResourceGraph module • Use Search-AzGraph cmdlet $pageSize = 100 $iteration = 0 $searchParams = @{ Query = 'where type =~ "Microsoft.Network/applicationGateways" | project id, subscriptionId, subscriptionDisplayName , resourceGroup, name, sslCertificates = properties.sslCertificates | order by id' First = $pageSize Include = 'displayNames' } $results = do { $iteration += 1 Write-Verbose "Iteration #$iteration" $pageResults = Search-AzGraph @searchParams $searchParams.Skip += $pageResults.Count $pageResults Write-Verbose $pageResults.Count } while ($pageResults.Count -eq $pageSize) GettingfasteranswersinAzureResourceManager
  • 40. Azure CLI How to use Azure Resource Graph in Azure CLI • Install Azure CLI • Install resource-graph extension • Use az graph query // Request a subset of results, skipping 20 items and getting the next 10. az graph query -q "where type =~ "Microsoft.Compute" | project name, tags" --first 10 -- skip 20 // Choose subscriptions to query. az graph query -q "where type =~ "Microsoft.Compute" | project name, tags" –subscriptions 11111111-1111-1111-1111-111111111111, 22222222-2222-2222-2222-222222222222 GettingfasteranswersinAzureResourceManager
  • 42. Resource changes 14 days of change history • Find when changes were detected on an Azure Resource Manager property • For each resource change, see property change details • See a full comparison of the resource before and after the detected change GettingfasteranswersinAzureResourceManager
  • 43. Resource changes REST API • Sample POST call to return list of changes for a resource GettingfasteranswersinAzureResourceManager POST https://management.azure.com/providers/Microsoft.ResourceGraph/resourceChanges?api- version=2018-09-01-preview { "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/MyResourceGroup/providers/Microsoft.Stora ge/storageAccounts/mystorageaccount", "interval": { "start": "2020-02-01T00:00:00.000Z", "end": "2020-02-15T00:00:00.000Z" }, "fetchPropertyChanges": false }
  • 44. Demo: Resource changes in Resource Explorer GettingfasteranswersinAzureResourceManager
  • 45.
  • 46.
  • 47. Resources Azure Resource Explorer Azure Resource Explorer (RAW) Azure Resource Graph documentation Azure Resource Graph quickstart queries Azure Resource Changes Azure CLI Azure PowerShell GettingfasteranswersinAzureResourceManager