Source: Azure Cloud Shell uses a secure linux vm with Powershell Core running on it and that shell has no access to any local resources (aka your file server) and you really can't connect to a git repo made by one of those fancy developers in your area - though you can clone one every time you open your cloud shell if that helps and may be good for their source control...I'm a sysadmin, I don't really get the git mantra except for backups. Also, many of your IT workers may attempt to access secure resources on insecure devices (aka their random personal tablet since you called them on a saturday and they don't want to VPN in using a laptop).
Resolution:
Assuming you have an AD group or Azure/O365 group that has your team members in it like we did:
- Log into portal.azure.com with permissions to create stuff in your subscription
- Create a Resource Group for your team in the same location as your subscription
- Grant Reader permissions for the team to the Resource Group (use the IAM menu option to grant this)
- Create a storage account with the cheapest settings possible (see below)
- Set the Resource Group to the one you created for your team in step 2
- Give it a nice, short, simple name for the Storage Account Name
- Set the location to the same location as your resource group (NOTE: I had problems with East US 2; if your subscription is in East US 2, choose US EAST for this)
- Set Performance to Standard
- Leave Account kind for StorageV2 (general purpose v2)
- Set Replication to Locally Redundant Storage (LRS) if possible, it's the cheapest
- Set Access Tier to Cool
- Use the Review and Create button and create the resource...this will take a minute
- Once the storage account is created, navigate to the Storage Account, and grant "Reader and Data Access" for your team
- If you receive errors about an unauthorized header, close your browser and re-login to Azure portal
- Inside the storage account, click Files and create a file share, call it something like "share", don't set a quota - every new user that accesses CloudShell and creates a profile will commit 5gb to this share so there's really no point in trying to limit unless you are scared of the hackers
- Click the "share" share so that it opens and click "Upload" and upload scripts and other resources here for your team
- Click the Cloud Shell button immediately to the right of the search bar in Azure Portal
- Click PowerShell as the language (you can change this later if you like)
- Click Advanced Settings on the right
- Make sure the settings all match what you have made (you may have to manually type the Share name)
- Click Connect/Yes/whatever allows it to go
cd $HOME/clouddriveNow your PowerShell window is located in the main directory of the share...you can use dir to list the contents and even use tab completion to load your script name and it'll work. One downside: you cannot access local resources (e.g. local Active Directory or modules) when the script is accessed within cloud shell (you can actually map it as a network drive). The best way to handle this situation is to create a Hybrid Runbook Worker so that you can create Runbooks (aka scripts) and use the scripts stored in your shared location to call the runbooks and specify that they run on the Hybrid Runbook Worker.
No comments:
Post a Comment