SlideShare a Scribd company logo
1 of 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

More Related Content

More from 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
 

More from 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
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

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