{"id":12993,"date":"2020-07-22T11:08:17","date_gmt":"2020-07-22T11:08:17","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=12993"},"modified":"2022-03-14T10:34:54","modified_gmt":"2022-03-14T10:34:54","slug":"creating-a-custom-role-using-powershell","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/","title":{"rendered":"Creating a Custom Role using PowerShell"},"content":{"rendered":"\n<p class=\"has-text-align-right\"><strong><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-104-microsoft-azure-administrator-associate\/\" target=\"_blank\" rel=\"noreferrer noopener\">Return to AZ-104 Tutorial<\/a><\/strong><\/p>\n\n\n\n<p>There are times when we require to create our own custom roles, when the&nbsp;Azure built-in roles&nbsp;do not meet the specific needs of the organization. We will now learn to create a custom role named Reader Support Tickets using Azure PowerShell. Moreover, the custom role enables the user to view everything in the management plane of a subscription and also open support tickets.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Prerequisites to create a custom role <\/strong><\/h5>\n\n\n\n<ul class=\"wp-block-list\"><li>We need the permissions to create custom roles, such as Owner or User Access Administrator<\/li><li>We also need Azure Cloud Shell or Azure PowerShell<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Steps to Create a Custom Role using PowerShell<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>First Step  &#8211; <\/strong>In the first step in PowerShell, use the Get-AzProviderOperation command to get the list of operations for the Microsoft.Support resource provider. This will assist to understand the operations that are available to create your permissions. <\/li><li><strong>Second Step &#8211; <\/strong>In this step, use the Get-AzRoleDefinition command to output the Reader role in JSON format.<\/li><li><strong>Third Step  &#8211; <\/strong>In the third step, Open the ReaderSupportRole.json file in an editor.<\/li><li><strong>Fourth Step &#8211; <\/strong>Now edit the JSON file to add the &#8220;Microsoft.Support\/*&#8221; operation to the Actions property. It is important to ensure to include a comma after the read operation. This action will allow the user to create support tickets.<\/li><li><strong>Fifth Step &#8211; <\/strong>Then get the ID of your subscription using the Get-AzSubscription command.<\/li><li><strong>Sixth Step  &#8211; <\/strong>In AssignableScopes, you must add subscription ID with the following format: &#8220;\/subscriptions\/00000000-0000-0000-0000-000000000000&#8221;. Also, we must add explicit subscription IDs, otherwise, such that it would not allow importing the role into your subscription.<\/li><li><strong>Seventh Step &#8211; <\/strong>In this step we delete the Id property line and change the IsCustom property to true.<\/li><li><strong>Eighth Step &#8211; <\/strong>Now you must change the Name and Description properties to &#8220;Reader Support Tickets&#8221; and &#8220;View everything in the subscription and also open support tickets.&#8221;<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Ninth Step &#8211; <\/strong>In order to create the new custom role, you must use the New-AzRoleDefinition command and specify the JSON role definition file.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-administrator-associate-az-104-free-practice-test\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/06\/practice-test-2.png\" alt=\"Practice Test for AZ-104\"\/><\/a><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Deleting a Custom Role <\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>First, use the Get-AzRoleDefinition command to get the ID of the custom role.<\/li><li>Second, use the Remove-AzRoleDefinition command and specify the role ID to delete the custom role.<\/li><li>Lastly, when asked to confirm, type Y.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Steps to Update Custom Role<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>First, update the JSON file, use the Get-AzRoleDefinition command to output the custom role in JSON format.<\/li><li>Second, open the file in an editor.<\/li><li>Next, in Actions, add the operation to create and manage resource group deployments &#8220;Microsoft.Resources\/deployments\/*&#8221;.<\/li><li>Fourth, to update the custom role, use the Set-AzRoleDefinition command and specify the updated JSON file.<\/li><li>Also in order to use the PSRoleDefintion object to update your custom role, first use the Get-AzRoleDefinition command to get the role.<\/li><li>Then, call the Add method to add the operation to read diagnostic settings.<\/li><li>Lastly, use the Set-AzRoleDefinition to update the role.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-administrator-associate-az-104-online-course\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/07\/testpreptraining.ai-2-1-750x117.png\" alt=\"Microsoft Azure AZ-104 Online Course\" class=\"wp-image-12856\"\/><\/a><\/figure><\/div>\n\n\n\n<p class=\"has-text-align-right\"><strong>Reference: <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/role-based-access-control\/tutorial-custom-role-powershell\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft Documentatio<\/a>n<\/strong><\/p>\n\n\n\n<p><strong><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-104-microsoft-azure-administrator-associate\/\" target=\"_blank\" rel=\"noreferrer noopener\">Return to AZ-104 Tutorial<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Return to AZ-104 Tutorial There are times when we require to create our own custom roles, when the&nbsp;Azure built-in roles&nbsp;do not meet the specific needs of the organization. We will now learn to create a custom role named Reader Support Tickets using Azure PowerShell. Moreover, the custom role enables the user to view everything in&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-12993","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating a Custom Role using PowerShell - Testprep Training Tutorials<\/title>\n<meta name=\"description\" content=\"Learn to Create a Custom role using PowerShell and boost your chances to qualify Microsoft Azure Administrator AZ-104 Exam Now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a Custom Role using PowerShell - Testprep Training Tutorials\" \/>\n<meta property=\"og:description\" content=\"Learn to Create a Custom role using PowerShell and boost your chances to qualify Microsoft Azure Administrator AZ-104 Exam Now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-14T10:34:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/06\/practice-test-2.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/\",\"name\":\"Creating a Custom Role using PowerShell - Testprep Training Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2020-07-22T11:08:17+00:00\",\"dateModified\":\"2022-03-14T10:34:54+00:00\",\"description\":\"Learn to Create a Custom role using PowerShell and boost your chances to qualify Microsoft Azure Administrator AZ-104 Exam Now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating a Custom Role using PowerShell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"name\":\"Testprep Training Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\",\"name\":\"Testprep Training\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"contentUrl\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"width\":583,\"height\":153,\"caption\":\"Testprep Training\"},\"image\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating a Custom Role using PowerShell - Testprep Training Tutorials","description":"Learn to Create a Custom role using PowerShell and boost your chances to qualify Microsoft Azure Administrator AZ-104 Exam Now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Creating a Custom Role using PowerShell - Testprep Training Tutorials","og_description":"Learn to Create a Custom role using PowerShell and boost your chances to qualify Microsoft Azure Administrator AZ-104 Exam Now!","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2022-03-14T10:34:54+00:00","og_image":[{"url":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/06\/practice-test-2.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/","name":"Creating a Custom Role using PowerShell - Testprep Training Tutorials","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2020-07-22T11:08:17+00:00","dateModified":"2022-03-14T10:34:54+00:00","description":"Learn to Create a Custom role using PowerShell and boost your chances to qualify Microsoft Azure Administrator AZ-104 Exam Now!","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/creating-a-custom-role-using-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Creating a Custom Role using PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","name":"Testprep Training Tutorials","description":"","publisher":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization","name":"Testprep Training","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","contentUrl":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","width":583,"height":153,"caption":"Testprep Training"},"image":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/12993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/comments?post=12993"}],"version-history":[{"count":5,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/12993\/revisions"}],"predecessor-version":[{"id":52810,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/12993\/revisions\/52810"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=12993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=12993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=12993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}