{"id":622,"date":"2021-06-30T19:55:34","date_gmt":"2021-06-30T19:55:34","guid":{"rendered":"https:\/\/www.spktechfit.com\/?p=622"},"modified":"2021-06-30T19:55:34","modified_gmt":"2021-06-30T19:55:34","slug":"8-manage-subscriptions-and-governance","status":"publish","type":"post","link":"https:\/\/www.spktechfit.com\/?p=622","title":{"rendered":"8. Manage Subscriptions and Governance"},"content":{"rendered":"<h1>Accounts, Subscriptions and Resource Groups<\/h1>\n<ol>\n<li><b>Account<\/b>: this is a user or an application. This is the basis for authentication.<\/li>\n<li><b>Tenant<\/b>: this is the organisation or the company<br \/>\n&#8211;\u00a0 Usually a domain name is related to this.<br \/>\n&#8211; a dedicated instance of Azure Active Directory<br \/>\n&#8211; every Azure account is part of at least one tenant<\/li>\n<li><b>Subscription<\/b>: an agreement with Microsoft to use AZURE services, and how you are going to pay for that. All Azure resources usage gets billed depending on the payment method of the subscription:<br \/>\n&#8211; Free subscriptions<br \/>\n&#8211; Pay as you go<br \/>\n&#8211; Enterprise agreements<br \/>\n<b><i>Note: not every tenant needs to have a subscription and Tenants can have more than one subscription. <\/i><\/b><\/li>\n<li><b>Resources<\/b>: this is any entity managed by Azure. EG: VM, web app, storage account, public IP address, network interface card, network security group etc\u2026<\/li>\n<li><b>Resource Group: <\/b>\u00a0a way or organising resources. Similar to an OU in AD. All resources can only belong to the one Resource Group.<br \/>\nIt is a way of separating projects , keeping unrelated items separate.<\/li>\n<\/ol>\n<h1>The Subscription Dashboard<\/h1>\n<p>The subscription is the basis of billing. It gives a breakdown of the services and resources by cost. It can give you forecasts for your spending for the month.<br \/>\nThis is where you make changes to credit cards etc\u2026<\/p>\n<h1>Assign Administrator permissions to Subscription<\/h1>\n<p>You can add another user as admin of your subscription.<\/p>\n<p>To do this:<\/p>\n<ul>\n<li>From within the Subscriptions dashboard, select &#8220;Access Control (IAM)&#8221;<\/li>\n<li>Click on &#8220;Add&#8221;<\/li>\n<li>Select the user you want to give access to<\/li>\n<li>Assign this user the &#8220;Contributor&#8221; role assignment. This will allow them to make changes to the subscription, but not assign permissions to other people.<\/li>\n<\/ul>\n<p>There are 100s of role assignments to choose from and they can get very granular.<\/p>\n<h1>Cost Centre and Tagging<\/h1>\n<p>Cost Analysis allows you to dig into the Locations and Resource Groups by what they are costing in the month.<\/p>\n<h2>Tagging<\/h2>\n<p>You can create custom tags and then &#8220;Tag&#8221; resources. These are meta data you can attach to resources. You can then run reports per tag for costs etc&#8230; An example of using tags is:<\/p>\n<ul>\n<li>Billing code<\/li>\n<li>Created by<\/li>\n<li>Environment<\/li>\n<\/ul>\n<h1>Azure Policy<\/h1>\n<p>You can use Azure Policy to define and enforce company standards and SLA&#8217;s across some or all of your companies resources.<\/p>\n<p>There are some built in policies you can use:<\/p>\n<ul>\n<li>Require SQL Server 12.0<\/li>\n<li>Allowed Locations<\/li>\n<li>Allowed VM SKUs<\/li>\n<li>Allowed Resource Type<\/li>\n<\/ul>\n<h2>Assigning a policy<\/h2>\n<p>You assign Policies through the Azure Portal by going to &#8220;Policy Assignments -&gt; Assign Policy&#8221;.<\/p>\n<p>The options you set are:<\/p>\n<ul>\n<li>Scope: Subscription or Resource Group<\/li>\n<li>Exclusions: you can exclude specific resources<\/li>\n<li>Policy Definition: Here you can select a built-in or custom policy. The built in policies can do things like:\n<ul>\n<li>Deploy threat protection<\/li>\n<li>Audit resources<\/li>\n<li>Set restrictions<\/li>\n<\/ul>\n<\/li>\n<li>Assignment name: set a name<\/li>\n<\/ul>\n<h2>Creating Custom Policies<\/h2>\n<p>You can create policy definition through &#8220;Policies -&gt; Definitions&#8221;. The definitions are made up of JSON files. You can download samples of these from GitHub<\/p>\n<h2>Managing Policy by PowerShell<\/h2>\n<p>Everything you can do in the portal you can do through PowerShell<\/p>\n<p>You can use PowerShell on your machine or use the &#8220;CloudShell&#8221;.<\/p>\n<p>You will need to install the AZ module on your machine.<\/p>\n<p><b>To list policiy definitions:<\/b><\/p>\n<pre>Get-AzPolicyDefinition\r\nGet-AzPolicyDefinition | Where-Object { $_.Properties.DisplayName -eq \"Ausit missing tags on resources\" }<\/pre>\n<p><b>Creating a policy using a definition:<\/b><\/p>\n<pre>New-AzPolicyAssignment -Name \"Checkingrules\" -DisplayName \"Checking the rules\" -scope $resourceGroup.iresourceid -PolicyDefinition $definition<\/pre>\n<p>&nbsp;<\/p>\n<h1>Subscriptions and Management Groups<\/h1>\n<p>You can have more than one subscription in the one tenant.<\/p>\n<h2>Management Groups<\/h2>\n<p>These are basically OU&#8217;s that contain other management groups or subscriptions.\u00a0You can assign users to the Management Group and they will get access to the subscription underneath.<\/p>\n<p>&nbsp;<\/p>\n<h1>Resource Groups and Resource Locks<\/h1>\n<p>Resource Groups are basically an organisational structure for your resources. You can create as many as you need. The Resource Group name needs to be unique to your account.<\/p>\n<p>They can contain things like:<\/p>\n<ul>\n<li>VMs<\/li>\n<li>VNets<\/li>\n<li>Network Security groups<\/li>\n<li>Disks<\/li>\n<li>Public IP Addresses<\/li>\n<\/ul>\n<p>Things you can do at the Resource Group level:<\/p>\n<ul>\n<li>Policies<\/li>\n<li>Locks<\/li>\n<li>Reports<\/li>\n<li>Deployments<\/li>\n<\/ul>\n<p><b><i>Deleting a Resource Group deletes all the resources inside it also!<\/i><\/b><\/p>\n<h2>Resource Locks<\/h2>\n<p>A lock prevents you from changing or deleting the Resource Group. There are 2 types of locks:<\/p>\n<ol>\n<li>No changes (Read Only) &#8211; this prevents you from making any changes or even stopping a VM<\/li>\n<li>No deletions<\/li>\n<\/ol>\n<p>You can add a lock by going to &#8220;Locks&#8221; in the Resource Group settings.<\/p>\n<h1>Resource Group Policies<\/h1>\n<p>Go to Resource Group -&gt; Policy &#8211; Assignments<\/p>\n<p>You ca assign policies such as &#8220;Allow Locations&#8221;. This only allows items in the Resource Group to be in certain locations.<\/p>\n<h1>Move Resources<\/h1>\n<p>Items in a Resource Group can be moved to:<\/p>\n<ul>\n<li>Another Resource Group<\/li>\n<li>Another Subscription<\/li>\n<li>Another Location<\/li>\n<\/ul>\n<p><b>NOTE: when you change an items Resource Group its &#8220;Resource ID&#8221; will change. This is because the Resource Group name is part of the Resources ID. You need to update any scripts that may be using this Resource ID.<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Accounts, Subscriptions and Resource Groups Account: this is a user or an application. This is the basis for authentication. Tenant: this is the organisation or the company &#8211;\u00a0 Usually a domain name is related to this. &#8211; a dedicated instance of Azure Active Directory &#8211; every Azure account is part of at least one tenant [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[13,3],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts\/622"}],"collection":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=622"}],"version-history":[{"count":2,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts\/622\/revisions"}],"predecessor-version":[{"id":624,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=\/wp\/v2\/posts\/622\/revisions\/624"}],"wp:attachment":[{"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spktechfit.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}