Create a Tag-Based Storage Policy

You can create storage policies by using tags from vCenter Server.

Prerequisites

  • Verify that you are connected to a vCenter Server system.
  • Verify that you have Profile-driven storage update privileges.
  • Verify that a tag named Tag1 exists in the vCenter Server environment.

Procedure

  1. Get the Tag1 tag and store it in the $tag variable.
    $tag = Get-Tag -Name 'Tag1'
  2. Create a rule with the $tag tag and store the rule in the $rule variable.
    $rule = New-SpbmRule -AnyOfTags $tag
  3. Create a rule set by using the $rule rule and store the rule set in the $ruleset variable.
    $ruleset = New-SpbmRuleSet -AllOfRules $rule
  4. Create a tag-based policy named Tag-Based-Policy by using the $ruleset rule set and store the policy in the $policy variable.
    $policy = New-SpbmStoragePolicy -Name 'Tag-Based-Policy' -Description 'This policy is created by using a tag' -AnyOfRuleSets $ruleset