Create New Site & Enable Git Deployment
As you know you need to use your Live ID sign into Azure portal. Once you log into the Azure portal you can create a new Web Site by clicking on the “New” command bar at the bottom:
Once your site is created then on the right side under Quick Glance there should see a way to “Set Git Publishing” which will setup your Git Repository and give you a Git URL to push to. At that time if you have not set up your deployment credential then you will be asked to do so.
Git/FTP Credentials in Azure
If you set your deployment credentials before and do not remember now then you will be able to “Reset deployment credentials” from the Quick Glance section as highlighted below. Clicking on “Reset deployment credentials” should give you the below screen:
We went back and forth on setting the text on this dialog to be as short and yet as meaningful as we could but I will try to re-iterate it here. Live id credentials can only be used to sign into Azure portal and not to deploy via Git to Windows Azure Web Sites. For this very reason there are basic auth credentials available per user to be used for deployment. These are basic auth credentials which are used by both FTP and Git and are common for all the sites of the same user.
When you Set up Git publishing on any site then a Git repository is created specifically for that site and you get a Git repository URL. Do note that after the repository is setup you also see a “Deployments” tab on the page which contains Git instructions.
Typical Git URL in Azure looks something like below:
https://vishal@testsitevishal.scm.azurewebsites.net/TestSiteVishal.git
notice that vishal@ is appended in front of the Git site name denoting the user name. If I had another site called FooBar the URL would look like:
https://vishal@FooBar.scm.azurewebsites.net/FooBar.git
The common part being my user name and when I actually start pushing my site from command prompt the only thing I will need to enter is the password and it will be the same whether I am pushing to FooBar or TestSiteVishal.
I quickly created a Bakery site via WebMatrix 2 and git pushed it to my TestSiteVishal above and my “Deployments” tab now looks as below (notable pieces being my live id and Deployed By field in the deployment history):
When I try to FTP access any of my site the credentials are the same (except in case of FTP the username is usually SiteName\Username i.e. TestSiteVishal\Vishal or FooBar\Vishal)
Additional Deployment Users for your Git Repo
Now let us do a tiny bit of extrapolation here. A user has single basic deployment credentials for FTP & Git within Azure Web Sites which are applicable to any site that the user has access to. Any user gets access to Azure Web Sites based on their Azure Subscriptions, so as long as you can add users to Azure Subscription then other users should be able to get access to the same sites and thereby get access to the Git repo of that site as well. It is possible to add more users to Azure Subscription by making them a co-admin.
So as long as you can make someone as a co-admin on the subscription which has access to the Website with Git Repo then on that user’s dashboard they should see a Git url with their user name and they can use the procedure above to start deploying to that Git Repo.
Setting up a Co-Admin
Setting up a co-admin is relatively simple. You can go to http://windows.azure.com which is the original Azure silverlight based portal and follow the instructions on MSDN article at http://msdn.microsoft.com/en-us/library/windowsazure/gg456328.aspx and you should be all set.
If you are being redirected to the new Azure portal at https://manage.windowsazure.com then click on “Preview” in the middle of the title bar as shown below:
which should give you an option to go to the previous portal as shown below:
Once you are in the older Azure portal then click on “Hosted Services, Storage Accounts & CDN”, select the subscription of your choice and click “Add New Co-Admin” on the top Ribbon
which should then allow you to add other co-admins by using their Live Ids as below:
Now the second Live Id account which you added as co-admin should be able to create their own deployment credentials and should be able to use those deployment credentials to Git push to Azure.
When I logged into Azure portal as co-admin (which I just added above) I could see all the sites from the original account and was able to “Reset deployment credentials” from the dashboard. Note: Since the co-admin does not know the original users credential the step of “Reset deployment credentials” is an important step for the co-admin. After doing that when I moved to my “Deployments” tab it looked as below:
Notice that the deployed by is vishal vs. the GitUrl has the user VishalRJoshi
As a co-admin I can now use the Git URL to clone my site locally on a different machine using my own co-admin basic credentials. Notice the command git clone https://VishalRJoshi@… below:
I made some quick edits to the site and now I am ready to push to Azure again. As a co-admin I need to add my Azure remote again so I will do so by using the command
git remote add azure https://VishalRJoshi@testSiteVishal…
and then simply git push azure master and use the new reset deployment credentials.
Finally I can see my change deployed to my Azure site using the co-admin user (notice the Deployed by field now says VishalRJoshi:
I hope this helps you add contributors to you Azure Git repository and you have fun with git pushing to Azure.
/*code awesomely*/
Vishal
No comments:
Post a Comment