{"id":404630,"date":"2024-06-29T17:49:17","date_gmt":"2024-06-29T17:49:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=404630"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=404630","title":{"rendered":"<span>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 Azure \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Resource Graph \u0438 PowerShell<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/u-\/mw\/93\/u-mw936okhsw8yqn5unxa8u0buw.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/u-\/mw\/93\/u-mw936okhsw8yqn5unxa8u0buw.jpeg\" data-blurred=\"true\"\/><\/div>\n<p>  \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0439\u0434\u0451\u0442 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u043f\u0438\u0441\u043a\u0430 VM \u0441\u0440\u0435\u0434\u0438 \u0441\u043e\u0442\u0435\u043d \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a Azure? \u0426\u0435\u043b\u0430\u044f \u0432\u0435\u0447\u043d\u043e\u0441\u0442\u044c. \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0440\u0442\u0430\u043b Azure \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0435 1000 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a \u0443 \u0432\u0430\u0441 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u0435\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b Azure Resource Graph \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u0443 \u0441\u043b\u0443\u0436\u0431\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0432 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<a name=\"habracut\"><\/a><\/p>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<p>  <a href=\"#anchorid\">\u2014 Resource Graph \u0438 Kusto Query Language<\/a><br \/>  <a href=\"#anchorid1\">\u2014 \u041c\u043e\u0434\u0443\u043b\u044c Resource Graph \u0434\u043b\u044f PowerShell<\/a><br \/>  <a href=\"#anchorid2\">\u2014 \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/a><br \/>  <a href=\"#anchorid3\">\u2014 \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/a><br \/>  <a href=\"#anchorid4\">\u2014 \u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/a><br \/>  <a href=\"#anchorid5\">\u2014 \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/p>\n<p>  <a name=\"anchorid\"><\/a> <\/p>\n<h2><font color=\"#076184\">Resource Graph \u0438 Kusto Query Language<\/font><\/h2>\n<p>  Azure Resource Graph \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441\u0440\u0435\u0434\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b Resource Graph.<\/p>\n<p>  Kusto Query Language (KQL) \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e Resource Graph \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. KQL \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <code>join <\/code>\u0438 <code>union<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c.<\/p>\n<hr\/>\n<p><b><font color=\"#163C51\">\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430:<\/font><\/b><\/p>\n<p>  \u0427\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e Kusto. \u042d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0438\u0434\u043e\u043d\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 SQL.<br \/>  \u0421\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445 \u0442\u043e\u0447\u043a\u043e\u0439 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. \u0422\u043e\u0447\u043d\u043e \u043a\u0430\u043a \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435 \u0411\u0414. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c Tabular Expression Statement. \u041f\u0435\u0440\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 |. \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 Kusto \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a (\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 docs.microsoft.com):<\/p>\n<pre><code class=\"plaintext\">StormEvents  | where StartTime >= datetime(2007-11-01) and StartTime &lt; datetime(2007-12-01) | where State == \"FLORIDA\"   | count<\/code><\/pre>\n<p>  \u041b\u044e\u0431\u043e\u043c\u0443 \u0445\u0430\u0431\u0440\u0430\u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0442\u0443\u0442 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. <\/p>\n<hr\/>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441\u044b Resource Graph \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u043f\u043e\u0440\u0442\u0430\u043b\u0435 Azure. \u041d\u043e \u043c\u044b-\u0442\u043e \u0441 \u0432\u0430\u043c\u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c PowerShell. \u0414\u0430, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c Resource Graph Explorer, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0439 UI, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Resource Graph. \u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u044b \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u044d\u0442\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442\u0435 \u0437\u043d\u0430\u0442\u044c \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430\u0438\u0437\u0443\u0441\u0442\u044c \u0438 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u0440\u043e\u0447\u0438\u0442\u044c \u0438\u0445 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qg\/82\/d-\/qg82d-tcwoasji9c0lgdxlxkgsi.png\" data-src=\"https:\/\/habrastorage.org\/webt\/qg\/82\/d-\/qg82d-tcwoasji9c0lgdxlxkgsi.png\"\/><br \/>  <i><font color=\"#858585\">\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0432 Azure Portal \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a\u0430 Resource Graph<\/font><\/i><\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441 \u0438\u0445 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a <code>ID<\/code>, <code>name<\/code>, <code>subscriptionID<\/code>, <code>resourceGroup <\/code>\u0438 \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>  <a name=\"anchorid1\"><\/a> <\/p>\n<h2><font color=\"#076184\">\u041c\u043e\u0434\u0443\u043b\u044c Resource Graph \u0434\u043b\u044f PowerShell<\/font><\/h2>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c <code>Az.ResourceGraph<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 PowerShell \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 Azure \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438\u043b\u0438 \u0441\u0440\u0435\u0434\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a. \u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 PowerShell:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" resources | where name starts with 'Network' \" $result = Search-AzGraph -Query $KustoQuery $result | select name<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 Kusto \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<pre><code class=\"plaintext\">PS C: $KustoQuery = \" >> resources >> | where name starts with 'Network' >> \" $result = Search-AzGraph -Query $KustoQuery $result | select name  name - - - - NetworkWatcher_cenralus NetworkWatcher_norteurope NetworkWatcher_westeurope NetworkWatcher_westus NetworkWatcher_eastus NetworkWatcher_japanwest NetworkWatcher_norteurope NetworkWatcher_uksouth NetworkWatcher_westeurope NetworkWatcher_eastus NetworkWatcher_norteurope  PS C:\\> <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u0441 <code>Network<\/code>.  <\/p>\n<hr\/>\n<p><b><font color=\"#163C51\">\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430:<\/font><\/b><br \/>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 PowerShell \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <code>oh-my-posh<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Windows Terminal. <code>oh-my-posh<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a Powershell, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0430\u043a \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 Linux. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438,<code> reverse-i-search<\/code>.  <\/p>\n<hr\/>\n<p>  <a name=\"anchorid2\"><\/a> <\/p>\n<h2><font color=\"#076184\">\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f<\/font><\/h2>\n<p>  \u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e PowerShell \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Resource Graph \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0435 1000 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 \u0432\u0430\u0441 \u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p>\n<p>  \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435. \u041b\u044e\u0431\u043e\u0439, \u043a\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0443\u0434\u0438\u0432\u0438\u0442\u044c\u0441\u044f. \u041d\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0442\u043e \u043e\u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c. \u041c\u044b \u0436\u0435 \u043d\u0435 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c, \u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u0437 AD. \u0415\u0441\u043b\u0438 \u0438\u0445 \u043d\u0430\u043f\u043b\u043e\u0434\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 1000, \u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>  \u0415\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434 \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 1000 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043e\u0431\u043e\u0439\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0438\u0445 \u0447\u0438\u0441\u043b\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>Skip<\/code>. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435 \u043f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0434\u0430\u0451\u0442 \u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435. \u0422\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>first <\/code>\u0438 <code>Skip<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f\u0441\u044c 1000.<\/p>\n<p>  \u0412\u0441\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/governance\/resource-graph\/concepts\/work-with-data\">\u044d\u0442\u043e\u043c\u0443 <\/a>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443. \u0422\u0430\u043c \u0432\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438\u0437\u043b\u043e\u0436\u0430\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b. <\/p>\n<pre><code class=\"bash\">$result = Search-AzGraph -Query $KustoQuery -first 5 $result | select name $result = Search-AzGraph -Query $KustoQuery -Skip 5 $result | select name<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/1i\/7e\/nk\/1i7enk3qejvnxdy2b4znjvclo-y.png\" data-src=\"https:\/\/habrastorage.org\/webt\/1i\/7e\/nk\/1i7enk3qejvnxdy2b4znjvclo-y.png\"\/><br \/>  <i><font color=\"#858585\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>first <\/code>\u0438 <code>Skip <\/code>\u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 1000 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/font><\/i><\/p>\n<p>  <a name=\"anchorid3\"><\/a> <\/p>\n<h2><font color=\"#076184\">\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/font><\/h2>\n<p>  \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Resource Graph.<\/p>\n<h3><font color=\"#163C51\">\u0412\u044b\u0432\u043e\u0434 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043f\u043e \u0442\u0438\u043f\u0443<\/font><\/h3>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" Resources | where type == 'microsoft.storage\/storageaccounts' \" $result = Search-AzGraph -Query $KustoQuery $result | select name<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/kl\/7q\/e-\/kl7qe-ql3hhgtgj01tieygwa6s8.png\" data-src=\"https:\/\/habrastorage.org\/webt\/kl\/7q\/e-\/kl7qe-ql3hhgtgj01tieygwa6s8.png\"\/><br \/>  <i><font color=\"#858585\">\u0412\u044b\u0432\u043e\u0434 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0443\u0447\u0451\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/font><\/i><\/p>\n<h3><font color=\"#163C51\">\u0412\u044b\u0432\u043e\u0434 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d Windows<\/font><\/h3>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u043e\u043b\u044c\u043a\u043e VM \u0441 Windows:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" Resources | where type == 'microsoft.compute\/virtualmachines' | where properties.storageProfile.osDisk.osType == 'Windows' \" $result = Search-AzGraph -Query $KustoQuery $result | select name, @{l=\"OsType\";e={$_.properties.storageProfile.osDisk.osType}}<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/bu\/zo\/ds\/buzodsind8spytiy-9whwexwpyy.png\" data-src=\"https:\/\/habrastorage.org\/webt\/bu\/zo\/ds\/buzodsind8spytiy-9whwexwpyy.png\"\/><br \/>  <i><font color=\"#858585\">\u0412\u044b\u0432\u043e\u0434 VM \u0441 Windows<\/font><\/i><\/p>\n<h3><font color=\"#163C51\">\u0412\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 IP<\/font><\/h3>\n<p>  \u0412 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043d\u0438\u0436\u0435 \u043c\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 IP \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043d\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0434\u043b\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f <code>SampleColumnToRepresentResourceId<\/code>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/kb\/8s\/pz\/kb8spzwukkolxsnbnnzcflura2w.png\" data-src=\"https:\/\/habrastorage.org\/webt\/kb\/8s\/pz\/kb8spzwukkolxsnbnnzcflura2w.png\"\/><br \/>  <i><font color=\"#858585\">\u0412\u044b\u0432\u043e\u0434 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 IP \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0434\u043b\u044f <code>ResourceId<\/code><\/font><\/i><\/p>\n<h3><font color=\"#163C51\">\u0412\u044b\u0432\u043e\u0434 \u0433\u0440\u0443\u043f\u043f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0442\u0435\u0433\u043e\u043c<\/font><\/h3>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0435\u0433\u043e\u043c:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" resourcecontainers | where type == 'microsoft.resources\/subscriptions\/resourcegroups' | where tags['Importance'] == 'High' \" $result = Search-AzGraph -Query $KustoQuery $result | select name<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mv\/ny\/um\/mvnyumovxstnvys2ke2qsvmhl5a.png\" data-src=\"https:\/\/habrastorage.org\/webt\/mv\/ny\/um\/mvnyumovxstnvys2ke2qsvmhl5a.png\"\/><br \/>  <i><font color=\"#858585\">\u0412\u044b\u0432\u043e\u0434 \u0433\u0440\u0443\u043f\u043f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0442\u0435\u0433\u043e\u043c<\/font><\/i><\/p>\n<h3><font color=\"#163C51\">\u041f\u043e\u0434\u0441\u0447\u0451\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u0440\u0435\u0433\u0438\u043e\u043d\u0435<\/font><\/h3>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 <code>North Europe<\/code>, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0438\u0445 <code>subscriptionId<\/code>:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" resources | where location == 'northeurope' | summarize total=count () by subscriptionId \" $result = Search-AzGraph -Query $KustoQuery $result | select total, subscriptionId, @{l=\"location\";e={\"North Europe\"}}<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/83\/j5\/sh\/83j5shymjfho2pcw5ukxvj4404o.png\" data-src=\"https:\/\/habrastorage.org\/webt\/83\/j5\/sh\/83j5shymjfho2pcw5ukxvj4404o.png\"\/><br \/>  <i><font color=\"#858585\">\u041f\u043e\u0434\u0441\u0447\u0451\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u0440\u0435\u0433\u0438\u043e\u043d\u0435 North Europe<\/font><\/i><\/p>\n<h3><font color=\"#163C51\">\u0412\u044b\u0432\u043e\u0434 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 VM<\/font><\/h3>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 VM \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" resources | where type == 'microsoft.compute\/virtualmachines' | where properties.extended.instanceView.powerState.displayStatus == 'VM running' | project name, location, resourceGroup \" $result = Search-AzGraph -Query $KustoQuery $result<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/x9\/kt\/i9\/x9kti9po07hxgir-hsv3rfufjvu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/x9\/kt\/i9\/x9kti9po07hxgir-hsv3rfufjvu.png\"\/><br \/>  <i><font color=\"#858585\">\u0417\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 VM<\/font><\/i><\/p>\n<h3><font color=\"#163C51\">\u0412\u044b\u0432\u043e\u0434 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 VM, \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c<\/font><\/h3>\n<p>  VM, \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c, \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">$KustoQuery = \" policyresources | where type == 'microsoft.policyinsights\/policystates' | where properties.complianceState == 'NonCompliant' | where properties.resourceType =~ 'microsoft.compute\/virtualmachines' | project resourceGroup, id=properties.resourceId, ComplianceStatus = properties.complianceState \" $result = Search-AzGraph -Query $KustoQuery $result | fl *<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/hs\/-w\/vf\/hs-wvfja1z5pcasq8xy2ycqycfu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/hs\/-w\/vf\/hs-wvfja1z5pcasq8xy2ycqycfu.png\"\/><br \/>  <i><font color=\"#858585\">\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 VM<\/font><\/i><\/p>\n<hr\/>\n<p><b><font color=\"#163C51\">\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430: <\/font><\/b><br \/>  <a name=\"anchorid4\"><\/a><\/p>\n<h2><font color=\"#076184\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/font><\/h2>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e PowerShell \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 Kusto \u043c\u043e\u0436\u043d\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0432\u0430 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445: \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0438 \u041c\u0430\u0441\u0441\u0438\u0432 \u041e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. <\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>ConvertTo-Json<\/code>.<\/p>\n<p>  \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>resultFormat=Table<\/code>, \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 <code>ConvertTo-JSON<\/code>:<\/p>\n<pre><code class=\"plaintext\">{     \"totalRecords\": 47,     \"count\": 1,     \"data\": {         \"columns\": [{                 \"name\": \"name\",                 \"type\": \"string\"             },             {                 \"name\": \"type\",                 \"type\": \"string\"             },             {                 \"name\": \"location\",                 \"type\": \"string\"             },             {                 \"name\": \"subscriptionId\",                 \"type\": \"string\"             }         ],         \"rows\": [             [                 \"veryscaryvm2-nsg\",                 \"microsoft.network\/networksecuritygroups\",                 \"eastus\",                 \"11111111-1111-1111-1111-111111111111\"             ]         ]     },     \"facets\": [],     \"resultTruncated\": \"true\" } <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u044b <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/governance\/resource-graph\/concepts\/work-with-data#formatting-results\">\u0437\u0434\u0435\u0441\u044c<\/a>.  <\/p>\n<hr\/>\n<p>  <a name=\"anchorid5\"><\/a> <\/p>\n<h2><font color=\"#076184\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  Resource Graph \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 Azure, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0441\u0440\u0435\u0434\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u044f\u0437\u044b\u043a KQL \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell \u0438 Resource Graph.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0431\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0438\u0445 \u0436\u0438\u0437\u043d\u044c. KQL \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Azure. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 JSON, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 no-SQL \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 KQL \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f\u043c ELK, Graylog \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0441\u0431\u043e\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. <\/p>\n<hr\/>\n<p>\u041d\u041b\u041e \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430:<\/p>\n<ul>\n<li><a href=\"https:\/\/firstvds.ru\/?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=product&amp;utm_content=vds15exeptprogrev\"> \u2014 15% \u043d\u0430 \u0432\u0441\u0435 \u0442\u0430\u0440\u0438\u0444\u044b VDS<\/a> (\u043a\u0440\u043e\u043c\u0435 \u0442\u0430\u0440\u0438\u0444\u0430 \u041f\u0440\u043e\u0433\u0440\u0435\u0432) <b><font color=\"#163C51\">HABRFIRSTVDS<\/font><\/b>.<\/li>\n<p>  \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0434\u043e 31 \u0434\u0435\u043a\u0430\u0431\u0440\u044f 2021 \u0433.<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/586988\/\"> https:\/\/habr.com\/ru\/articles\/586988\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/u-\/mw\/93\/u-mw936okhsw8yqn5unxa8u0buw.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/u-\/mw\/93\/u-mw936okhsw8yqn5unxa8u0buw.jpeg\" data-blurred=\"true\"\/><\/div>\n<p>  \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0439\u0434\u0451\u0442 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u043f\u0438\u0441\u043a\u0430 VM \u0441\u0440\u0435\u0434\u0438 \u0441\u043e\u0442\u0435\u043d \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a Azure? \u0426\u0435\u043b\u0430\u044f \u0432\u0435\u0447\u043d\u043e\u0441\u0442\u044c. \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0440\u0442\u0430\u043b Azure \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0435 1000 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a \u0443 \u0432\u0430\u0441 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u0435\u0435. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b Azure Resource Graph \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044d\u0442\u0443 \u0441\u043b\u0443\u0436\u0431\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PowerShell, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0432 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-404630","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/404630","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=404630"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/404630\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}