Property Bags in SharePoint 2013

Property bags in SharePoint is one of few less talked topics in the SharePoint Space. In this blog, I will explain what property bag are, and what is it main usage in SharePoint environment.
 
Property Bag: As it name suggests, it is just a container to hold the property values. It is used to store configuration data in the sharepoint space. And we can store properties at the following levels: 
  1. Farm (SPFarm )
  2. Web application (SPWebApplication )
  3. Site collection (SPSite )
  4. Site (SPWeb )
  5. List (SPList )
This is something like app.config information in Microsoft ASP.NET.  Property Bags can be edited, created and deleted at all level.
 
Here, I have a given a example to create a Property bag at the Web Application  level. 
  1. $WebUrl = "http://mySites/sites/ "  
  2.   
  3. $web = Get-SPWeb $WebUrl  
  4.   
  5. $web.Properties ["MyNewProperty"] = "New value"  
Happy SharePointing :-)