Navigate Azure Resources Just like A FileSystem
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Tests
.gitignore
AzurePSDrive.Format.ps1xml
AzurePSDrive.psd1
AzurePSDrive.psm1
AzurePSDriveResource.psm1
AzurePSDriveStorageAccount.psm1
AzurePSDriveVM.psm1
AzurePSDriveWebApp.psm1
LICENSE.txt
Readme.md
appveyor.yml

Readme.md

Build Status

Master Development
av-image-master av-image-dev

Introduction:

AzurePSDrive provider is a SHiPS based PowerShell provider to simplify navigation and discovery of Azure Resource Manager items. This is based on Az cmdlets. The provider allows to browse Azure resources such as Subscriptions, ResourceGroups, deployments in providers such as Compute, Network, Storage. Deployments such as VirtualMachines, StorageContainers, NetworkInterfaces, SecurityGroups, VNets, WebApps can be seamlessly discovered including useful data about these.

Usage:

Using this provider is self explanatory. You are encouraged to traverse various resources such as Compute, Network, Storage, WebApps and so on. AzurePSDrive provider shows only Az providers that have deployments such as Virtual machines, Storage Containers. This version supports only retrieving Resource Manager items.

# Authenticate to your Azure account
# Login-AzAccount

# Create a drive for Az
$driveName = 'Az'
Import-Module AzurePSDrive
New-PSDrive -Name $driveName -PSProvider SHiPS -Root AzurePSDrive#Azure

cd $driveName":"
# Discover all subscriptions associated with the account
PS Az:\> dir

Mode SubscriptionName    SubscriptionId                         TenantId                                 State
---- ----------------    --------------                         -----                                    -----
+    AutomationGroup     xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx     Enabled
+    CloudOps            xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx     Disabled
+    DevOps              xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx     Enabled

# Navigate to a subscription
PS Az:\> cd .\AutomationGroup\

# Discover the first level directory under a subscription
PS Az:\AutomationGroup> dir
Mode  Name
----  ----
+     AllResources
+     ResourceGroups
+     VirtualMachines
+     StorageAccounts
+     WebApps

# Display all Azure resources under the current subscription
PS Az:\AutomationGroup>cd .\AllResources\
PS Az:\AutomationGroup\AllResources> dir

# Search Azure resources by keyword
PS az:\AutomationGroup\AllResources> dir *foobar*

Name        ResourceType                          ResourceGroupName    Location
----        ------------                          -----------------    --------
foobar1     Microsoft.Compute/virtualMachines     foobarrg             westus
foobar2     Microsoft.Compute/virtualMachines     foobarrg             westu

# Search for all VMs
PS az:\AutomationGroup> cd .\VirtualMachines\
PS az:\AutomationGroup\VirtualMachines>dir

# Search for my VMs starting a letter j*
PS az:\AutomationGroup\VirtualMachines> dir j*
ResourceGroupName   Name    Location    VmSize           OsType    NIC      ProvisioningState  PowerState
-----------------   ----    --------    ------           ------    ---      -----------------  ----------
JRG                 jvm1    eastus      Standard_DS1_v2  Windows   jnic-1   Succeeded          deallocated
JRG                 jvm2    westus      Standard_F1s     Linux      nic-2   Succeeded          running

# Start or Stop a VM
dir jvm2 | Stop-AzVM
PS az:\AutomationGroup\VirtualMachines> dir .\jvm2 | Stop-AzVM

# Search all storage accounts under my subscription
PS az:\AutomationGroup\StorageAccounts> dir
Mode  Name
----  ----
+     myacc
+     myacc2
+     myacc3

# Navigate to a particular storage account
PS az:\AutomationGroup\StorageAccounts> cd .\myacc\
PS az:\AutomationGroup\StorageAccounts\myacc> dir

Mode  Name
----  ----
+     Blobs
+     Files
+     Tables
+     Queues

# Navigate to Azure storage file share
PS az:\AutomationGroup\StorageAccounts\myacc> cd .\Files\
PS az:\AutomationGroup\StorageAccounts\myacc\Files> dir

Name     ConnectionString
----     ----------------
share1   \\myacc.file.core.windows.net\share1;AccountName=myacc
         AccountKey=<key omitted here>
share2   \\myacc2.file.core.windows.net\share2;AccountName=myacc2
         AccountKey=<key omitted here>

# Mount to Azure file share so that you can add/delete/modify files and directories
net use z: \\myacc.file.core.windows.net\share1  /u:AZURE\myacc <AccountKey>

# Navigate to a directory
PS az:\AutomationGroup\StorageAccounts\myacc\Files> cd .\share1\
PS az:\AutomationGroup\StorageAccounts\myacc\Files\share1> dir

Mode  Name
----  ----
+     .cloudconsole
.     .hello.ps1
# Discover ResourceGroups in the Subscription
PS az:\AutomationGroup> cd .\ResourceGroups\
PS az:\AutomationGroup\ResourceGroups> dir

Mode ResourceGroupName                     Location       ProvisioningState Tags
---- -----------------                     --------       ----------------- ----
+    azexpress                             southcentralus Succeeded
+    azexpress-posh2                       southcentralus Succeeded
+    ops-WestUS                            westus         Succeeded

PS Az:\AutomationGroup\ResourceGroups> cd .\azexpress\

# Discover Providers that have deployments
PS Az:\AutomationGroup\ResourceGroups\azexpress> dir

Mode ProviderName
---- ------------
+    Microsoft.ClassicStorage
+    Microsoft.Compute
+    Microsoft.Network
+    Microsoft.Storage
+    Microsoft.Web

# Navigate to your own VMs
PS Az:\AutomationGroup\ResourceGroups\azexpress\Microsoft.Compute\virtualMachines> dir

VMName         Location ProvisioningState VMSize          OS            SKU                             OSVersion AdminUserName NetworkInterfaceName
------         -------- ----------------- ------          --            ---                             --------- ------------- --------------------
azexpress-ctr-host westus   Succeeded         Standard_DS2_v2 WindowsServer 2016-Datacenter-with-Containers latest    localadmin    azexpress-ctr

# Discover NetworkInterfaces
PS Az:\AutomationGroup\ResourceGroups\azexpress\Microsoft.Network\networkInterfaces> dir

NetworkInterfaceName Location ProvisioningState VirtualMachineName PublicIpAddressName   NetworkSecurityGroupName IsPrimary
-------------------- -------- ----------------- ------------------ -------------------   ------------------------ ---------
azexpress-ctr        westus   Succeeded         azexpress-ctr-host azexpress-ctr-host-ip azexpress-ctr-host-nsg       True

# Get WebApps information
PS Az:\AutomationGroup\ResourceGroups\azexpress\Microsoft.Web\sites> dir


SiteName                       Location   State      OutboundIpAddresses  EnabledHostInfo                                                 WebSpace
--------                       --------   -----      -------------------  ---------------                                                 --------
azexpressSite                   West US    Stopped    42.139.137.127       azexpressSite.azurewebsites.net* SSl=Disabled                  2015-WestUSwebspace
                                                      40.11.139.85         azexpressSite.scm.azurewebsites.net SSl=Disabled

azexpressSite-powershell        West US    Running    42.112.85.127        azexpressSite-powershell.azurewebsites.net* SSl=Disabled       2015-WestUSwebspace
                                                      42.139.139.85        azexpressSite-powershell.scm.azurewebsites.net SSl=Disabled




# Get ServerFarms info
PS Az:\AutomationGroup\ResourceGroups\azexpress\Microsoft.Web\serverFarms> dir

ServerFarmName  Location ProvisioningState NumberOfWorkers NumberOfSites WebSpace
--------------  -------- ----------------- --------------- ------------- --------
2015Plan        West US  Succeeded         1               5             2015-WestUSwebspace



Dependencies:

Az.Profile, Az.Resources, Az.Compute, Az.Storage, Az.Websites and SHiPS PowerShell modules are required.

Caching:

Top level objects such as Subscriptions, Resource Groups, Resource Providers are cached to improve performance. Use dir -Force to refresh from Azure service. However, leaf level objects such as Virtual Machines, Network Interfaces, WebSites are not cached, since these items can have a smaller life cycle.

Server side filtering using Az ODataQuery

Supports performing server side filtering using $filter ODataQuery semantics. Simply use dir -Filter option when retrieving items.

Supported Az Provider Types in format.ps1xml:

ProviderType Name FullType
Microsoft.Compute virtualMachines Microsoft.Compute.virtualMachines
Microsoft.Compute virtualMachines/extensions Microsoft.Compute.virtualMachines.extensions
Microsoft.Compute availabilitySets Microsoft.Compute.availabilitySets
Microsoft.Network networkInterfaces Microsoft.Network.networkInterfaces
Microsoft.Network publicIPAddresses Microsoft.Network.publicIPAddresses
Microsoft.Network virtualNetworks Microsoft.Network.virtualNetworks
Microsoft.Network networkSecurityGroups Microsoft.Network.networkSecurityGroups
Microsoft.Network routeTables Microsoft.Network.routeTables
Microsoft.Storage storageAccounts Microsoft.Storage.storageAccounts
Microsoft.ClassicStorage storageAccounts Microsoft.ClassicStorage.storageAccounts
Microsoft.Web sites Microsoft.Web.sites
Microsoft.Web serverfarms Microsoft.Web.serverfarms