{"id":13646,"date":"2017-10-19T15:41:01","date_gmt":"2017-10-19T23:41:01","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/?p=13646"},"modified":"2019-03-05T16:39:14","modified_gmt":"2019-03-06T00:39:14","slug":"navigate-azure-resources-just-like-a-file-system","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/navigate-azure-resources-just-like-a-file-system\/","title":{"rendered":"Navigate Azure Resources Just Like a File System"},"content":{"rendered":"<div class=\"markdown-body\">\n<p><a href=\"https:\/\/myignite.microsoft.com\/videos\/56716\">At Microsoft Ignite<\/a> (<em>around 8:15 min<\/em>), we announced the Public Preview of <a href=\"https:\/\/azure.microsoft.com\/blog\/powershell-comes-to-azure-cloud-shell\/\">PowerShell in Azure Cloud Shell<\/a>.\u00a0 A unique feature of PowerShell experience in Azure Cloud Shell is navigation of Azure resources via the Azure drive (<em>Azure:<\/em>).\u00a0 Today, we are making this feature <a href=\"https:\/\/www.powershellgallery.com\/packages\/AzurePSDrive\">available on PowerShell Gallery<\/a> as well as making the <a href=\"https:\/\/github.com\/PowerShell\/AzurePSDrive\">source code available on GitHub<\/a>.\u00a0This enables you to navigate Azure resources from any machine running Windows PowerShell 5 or higher.<\/p>\n<h2>Simple Hierarchy in PowerShell (SHiPS) &#8211; An Easier Way to Build PowerShell Providers<\/h2>\n<p>AzurePSDrive is built on top of an abstraction layer &#8211; <a href=\"https:\/\/github.com\/PowerShell\/SHiPS\">SHiPS<\/a>, which simplifies developing PowerShell providers.\u00a0 SHiPS is also a <a href=\"https:\/\/docs.microsoft.com\/powershell\/module\/microsoft.powershell.core\/about\/about_providers\">PowerShell provider<\/a> that exposes datastores in a hierarchical manner (like a file system).\u00a0In other words, the data in your datastore can be treated like files and directories so that a user can navigate data via <code>cd<\/code> or <code>dir<\/code> commands.<\/p>\n<p>Writing a PowerShell provider can be challenging as one needs to implement various methods exposed by the base PowerShell provider classes and interfaces to make it work. SHiPS simplifies this experience by exposing fewer methods and enables PowerShell providers to be written using PowerShell classes syntax.<\/p>\n<p>Now, SHiPS module is also <a href=\"https:\/\/www.powershellgallery.com\/packages\/SHiPS\">available through PowerShell Gallery<\/a> as well as its <a href=\"https:\/\/github.com\/PowerShell\/SHiPS\">source code is available via GitHub<\/a>.<\/p>\n<p>With SHiPS, you can:<\/p>\n<ul>\n<li>Author PowerShell providers using PowerShell classes as well as C#<\/li>\n<li>Navigate the data store using <code>Get-Item<\/code> and <code>Get-ChildItem<\/code> cmdlets<\/li>\n<li>Build navigation model that works on both Windows PowerShell (.Net FullCLR) and PowerShell Core (.Net CoreCLR)<\/li>\n<\/ul>\n<h3>Built on Top of Community Contribution<\/h3>\n<p>SHiPS is built on top of <a href=\"https:\/\/github.com\/beefarino\/p2f\">P2F (PowerShell Provider Framework)<\/a>, created by Jim Christopher, which does the heavy lifting for the implementation of SHiPS.\u00a0 SHiPS with P2F provides the simplification of developing PowerShell provider.<\/p>\n<h3>User Experience<\/h3>\n<p>Once a SHiPS-based navigation is defined, such as AzurePSDrive, users can easily create a PSDrive by installing the modules from the <a href=\"https:\/\/www.powershellgallery.com\/\">PowerShell Gallery<\/a>.<\/p>\n<div class=\"highlight highlight-source-powershell\">\n<pre class=\"lang:default decode:true \">Update-Module AzureRM         # refresh AzureRM modules to the latest version\r\nInstall-Module AzurePSDrive   # will install SHiPS as its dependency\r\nImport-Module AzurePSDrive\r\nLogin-AzureRmAccount \r\nNew-PSDrive -Name Azure -PSProvider SHiPS -root 'AzurePSDrive#Azure'\r\ncd Azure:\r\nPS Azure:\\&gt;dir<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<p>In this example, <code>AzurePSDrive<\/code> is a PowerShell module written using PowerShell classes.\u00a0It defines a PowerShell class called <code>Azure<\/code> as the PowerShell provider root.\u00a0The syntax for <code>root<\/code> parameter of PSDrive for SHiPS provider is <code>Module#ClassName<\/code>.\u00a0During <code>New-PSDrive<\/code>, SHiPS loads the module, <code>AzurePSDrive<\/code>, and creates an instance of an &#8216;Azure&#8217; object.\u00a0When a user types <code>dir<\/code>, SHiPS calls GetChildItem() implemented within the Azure class.<\/p>\n<p>For more information, see SHiPS <a href=\"https:\/\/github.com\/PowerShell\/SHiPS\/blob\/development\/docs\/SHiPSDesign.md\">design documents<\/a>, <a href=\"https:\/\/github.com\/PowerShell\/SHiPS\/blob\/development\/docs\/SHiPSPublicAPIsMore.md\">public APIs<\/a> and <a href=\"https:\/\/github.com\/PowerShell\/SHiPS\/tree\/development\/samples\">samples<\/a>.<\/p>\n<h2>Call to Action<\/h2>\n<p>Try <code>AzurePSDrive<\/code> on your machine or in <a href=\"https:\/\/aka.ms\/cloudshell\">Azure Cloud Shell<\/a> and build PowerShell providers using SHiPS. Provide your feedback, bugs, and feature requests through <a href=\"https:\/\/github.com\/PowerShell\/SHiPS\/issues\">Github Issues<\/a>.<\/p>\n<p>Jianyun Tao\nPrincipal Software Engineer\nPowerShell Team<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>At Microsoft Ignite (around 8:15 min), we announced the Public Preview of PowerShell in Azure Cloud Shell.\u00a0 A unique feature of PowerShell experience in Azure Cloud Shell is navigation of Azure resources via the Azure drive (Azure:).\u00a0 Today, we are making this feature available on PowerShell Gallery as well as making the source code available [&hellip;]<\/p>\n","protected":false},"author":624,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[103,104,119,265,312],"class_list":["post-13646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-azure-resources-navigation","tag-azurepsdrive","tag-cloudshell","tag-powershell-provider","tag-ships"],"acf":[],"blog_post_summary":"<p>At Microsoft Ignite (around 8:15 min), we announced the Public Preview of PowerShell in Azure Cloud Shell.\u00a0 A unique feature of PowerShell experience in Azure Cloud Shell is navigation of Azure resources via the Azure drive (Azure:).\u00a0 Today, we are making this feature available on PowerShell Gallery as well as making the source code available [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/13646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/624"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=13646"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/13646\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=13646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=13646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=13646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}