{"id":912,"date":"2020-04-07T10:19:51","date_gmt":"2020-04-07T17:19:51","guid":{"rendered":"http:\/\/blog.nillsf.com\/?p=912"},"modified":"2020-04-07T10:20:01","modified_gmt":"2020-04-07T17:20:01","slug":"tag-resources-created-by-a-databricks-cluster","status":"publish","type":"post","link":"https:\/\/blog.nillsf.com\/index.php\/2020\/04\/07\/tag-resources-created-by-a-databricks-cluster\/","title":{"rendered":"Tag resources created by a Databricks cluster"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A lot of organizations rely on tags for organizing Azure resources. Tags are useful to contain metadata about owners, environment, function and are also very useful to keep track of costs. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you create an Azure Databricks cluster, the service will create a managed resource group on your behalf. This managed resource group has a special role assignment linked it: a Deny Assignment for all principals:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"318\" src=\"\/wp-content\/uploads\/2020\/04\/image.png\" alt=\"\" class=\"wp-image-913\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image.png 972w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-300x98.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-768x251.png 768w\" sizes=\"auto, (max-width: 972px) 100vw, 972px\" \/><figcaption>Deny assignment makes it impossible to make changes to the managed resource group and the resources in it.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This means that nobody in your AAD tenant, <em>user or service principal<\/em>, has the ability to make changes to the resources in that resource group. And that ability includes the ability to add\/remove tags to the resource group or the resources in the resource group.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You have two options to tag this managed resource group and the resources contained in it:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Through Azure Policy at creation time. For more info on this, check out <a href=\"https:\/\/blog.nillsf.com\/index.php\/2019\/09\/22\/automating-clean-up-of-demo-resources\/\">this earlier post<\/a> I made.<\/li><li>By tagging the Databricks resource directly. Since Feb 10 2020, the Databricks resource will propagate any tags applied to the Databricks resource to the managed resources it created. <\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Let me show you an example of both. I have a policy in place that automatically tags a resource group with its creation data. You can see that tag in the screenshot below. As you can also see, there are no custom tags applied to this resource group:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"282\" src=\"\/wp-content\/uploads\/2020\/04\/image-1.png\" alt=\"\" class=\"wp-image-914\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-1.png 894w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-1-300x95.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-1-768x242.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><figcaption>Tag set by Azure policy.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s now try to add additional tags to this. To achieve this, you&#8217;ll need to tag the Databricks resource itself. I added a tag to the Databricks resource called <code>newtag<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"595\" height=\"357\" src=\"\/wp-content\/uploads\/2020\/04\/image-2.png\" alt=\"\" class=\"wp-image-915\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-2.png 595w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-2-300x180.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><figcaption>Adding a tag to the Databricks resource.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This tag gets automatically added to the managed resource group:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"316\" src=\"\/wp-content\/uploads\/2020\/04\/image-3.png\" alt=\"\" class=\"wp-image-916\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-3.png 894w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-3-300x106.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-3-768x271.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><figcaption>Tag is applied to the managed resource group.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">And also to all the underlying resources:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"354\" src=\"\/wp-content\/uploads\/2020\/04\/image-4.png\" alt=\"\" class=\"wp-image-917\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-4.png 952w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-4-300x112.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-4-768x286.png 768w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><figcaption>Tag is also applied to any managed resources created.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this post I quickly explained how you can tag the resources created by a Databricks. You need to tag the Databricks resources, and that will propagate any tags to the managed resources it created.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A lot of organizations rely on tags for organizing Azure resources. Tags are useful to contain metadata about owners, environment, function and are also very useful to keep track of costs. When you create an Azure Databricks cluster, the service will create a managed resource group on your behalf. This managed resource group has a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":915,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,4],"tags":[102,101,104],"class_list":["post-912","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-management","tag-azure-policy","tag-databricks","tag-tagging"],"jetpack_featured_media_url":"https:\/\/nillsfblog.blob.core.windows.net\/media\/2020\/04\/image-2.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts\/912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/comments?post=912"}],"version-history":[{"count":1,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts\/912\/revisions"}],"predecessor-version":[{"id":918,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts\/912\/revisions\/918"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/media\/915"}],"wp:attachment":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/media?parent=912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/categories?post=912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/tags?post=912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}