How to setup passive FTP on a Windows Azure virtual machine
Wednesday, February 13, 2013 9:30:39 PM (GMT Standard Time, UTC+00:00)
This is more of a reminder for me than anything else. If you're looking for a great walkthrough on how to configure Passive FTP on a Windows Azure VM, check out the walkthrough from Ronald here -it got us up and running.
The thing that takes the time to write each time is the powershell script side of things so this time I made some notes:
- Run Get-AzurePublishSettingsFile to get your publishsettings file (save it somewhere easily accessible
- Run Import-AzurePublishSettingsFile d:\Azure.publishsettings
- Run the Get-AzureVM calls listed below (you can copy/paste in one go and powershell will work it's way through them -it can take a few minutes). If you're not sure what <ServiceName> and <Name> should be, these are the names you configured your VMs.
- To get the Service Name Run: Get-AzureVM
- To get the Name of the server run: Get-AzureVM -ServiceName '<ServiceName>' (from above)
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPData' -Protocol 'TCP' -LocalPort 20 -PublicPort 20 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTP' -Protocol 'TCP' -LocalPort 21 -PublicPort 21 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive00' -Protocol 'TCP' -LocalPort 7000 -PublicPort 7000 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive01' -Protocol 'TCP' -LocalPort 7001 -PublicPort 7001 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive02' -Protocol 'TCP' -LocalPort 7002 -PublicPort 7002 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive03' -Protocol 'TCP' -LocalPort 7003 -PublicPort 7003 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive04' -Protocol 'TCP' -LocalPort 7004 -PublicPort 7004 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive05' -Protocol 'TCP' -LocalPort 7005 -PublicPort 7005 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive06' -Protocol 'TCP' -LocalPort 7006 -PublicPort 7006 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive07' -Protocol 'TCP' -LocalPort 7007 -PublicPort 7007 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive08' -Protocol 'TCP' -LocalPort 7008 -PublicPort 7008 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive09' -Protocol 'TCP' -LocalPort 7009 -PublicPort 7009 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive10' -Protocol 'TCP' -LocalPort 7010 -PublicPort 7010 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive11' -Protocol 'TCP' -LocalPort 7011 -PublicPort 7011 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive12' -Protocol 'TCP' -LocalPort 7012 -PublicPort 7012 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive13' -Protocol 'TCP' -LocalPort 7013 -PublicPort 7013 | Update-AzureVM
Get-AzureVM -ServiceName '<ServiceName>' -Name '<Name>' | Add-AzureEndpoint -Name 'FTPPassive14' -Protocol 'TCP' -LocalPort 7014 -PublicPort 7014 | Update-AzureVM
Set Umbraco Folder Permissions with Powershell
Thursday, June 17, 2010 2:47:22 PM (GMT Daylight Time, UTC+01:00)
If you're not configuring Umbraco through a web installer, you've had your installs in place for years and never checked the permissions or whoever set the permissions up was lazy and gave IIS write access to the entire folder, there will come a time when you want to restrict modify access to just those user(s) who should have access.
You can find a (pretty) complete list of the files/folders that the Umbraco install should have access to here but assigning them across 101 different installs is a PITA . Thanks to a helpful PowerShell script to set folder permissions from PowerShell.nu you can easily automate the process.
For those of you not familiar with PowerShell (like me) complete instructions are below. For the rest, here's the command:
Get-ChildItem -path ##PATH TO YOUR INSTALL##
| Where { $_.name -eq "Bin" -or $_.name -eq "Config" -or $_.name -eq "Css" -or $_.name -eq "Data" -or $_.name -eq "Masterpages" -or $_.name -eq "Media" -or $_.name -eq "Scripts" -or $_.name -eq "Umbraco" -or $_.name -eq "Umbraco_client" -or $_.name -eq "UserControls" -or $_.name -eq "Xslt" }
| ForEach {./SetFolderPermission.ps1 -path $_.Fullname -Access "NETWORK SERVICE" -Permission Modify}
Instructions:
- Save the SetFolderPermission.ps1 script to your server
- Open your PowerShell console (I think it's installed by default if not, you can download PowerShell here)
- Copy the above PowerShell command into notepad
- Update "##PATH TO YOUR INSTALL##" to your Umbraco install
- If your IIS install doesn't use NETWORK SERVICE as the default user, update it to your user
- Make sure it's all on a single line
- Copy/Paste/Run in PowerShell
Bonus
If you're uber lazy and just have a web folder of Umbraco installs you can set the path to the folder of Umbraco installs and use:
Get-ChildItem -path ##PATH TO YOUR FOLDER## -recurse
| Where { $_.name -eq "Bin" -or $_.name -eq "Config" -or $_.name -eq "Css" -or $_.name -eq "Data" -or $_.name -eq "Masterpages" -or $_.name -eq "Media" -or $_.name -eq "Scripts" -or $_.name -eq "Umbraco" -or $_.name -eq "Umbraco_client" -or $_.name -eq "UserControls" -or $_.name -eq "Xslt" }
| ForEach {./SetFolderPermission.ps1 -path $_.Fullname -Access "NETWORK SERVICE" -Permission Modify}
I've not tried this mind you and can't recommend it but hey, it's there if you want it ;)
Deleting SVN directories with PowerShell
Saturday, July 05, 2008 4:25:32 PM (GMT Daylight Time, UTC+01:00)
I've been re-working our new SVN structures recently as I'm now starting to understand how it works but one of the issues I had was trying to move the files/folders from a previous SVN directory.
PowerShell is great if you understand it (which I'm also learning) so I thought I would share this little script with you. It just loops through the files/folders and removes all those named _svn. I found this script from Wyatt Lyon Preul and he complained about the length of the script, but from what I can tell you can condense that down to:
gci $folder -fil '_svn' -r -fo | ? {$_.psIsContainer} | ri -fo -r
I'm not that great with PowerShell yet but I hope that helps someone :)
WARNING: As ever, incase I'm wrong (it happens!) test that on a folder first that you don't worry about losing!