Saturday, March 21, 2015

How to get deployed package files from Azure Cloud Service


Method 1: Using Cerebrata Cmdlets

1. Create a Management Certificate from Visual Studio Command Prompt as an administrator
    - VS Cmd Prompt can be found at Visual Studio Tools folder
    - For Visual Studio 2013, path is
             C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts
    - Run  'Developer Command Prompt for VS2013' as administrator

2. Run the MakeCert command to create a certificate
    makecert -sky exchange -r -n "CN=<CertificateName>" -pe -a sha1 -len 2048 -ss My "<CertificateName>.cer"
   - Replace <CertificateName> with any name - say AzureMgmtCert
   Ref: https://msdn.microsoft.com/en-us/library/azure/gg551722.aspx

3. Certificate will be created to Personal Store
    - In Run prompt, type mmc and click enter
    - Select certificates and first option

4. Export certificate(.cer) to a local drive say c:\AzureMgmtCert.cer

5. Export the certificate to Azure Management Portal for a subscription
    - Select 'Settings' (left bottom option)
    - Select the tab 'Management Certificates'
    - Upload AzureMgmtCert.cer using Upload button from bottom

6. Install Cerebrata(trail or licensed) Cmdlets 
      Ref: http://www.cerebrata.com/products/azure-management-cmdlets/introduction

7. Open 'Microsoft Azure Powershell'

8. Run Get-DeploymentPackage
    - ServiceName: <Cloud Service Name>
    - Slot: <production/ staging>
    - SubscriptionId: XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX
    - Certificate: C:\azuremgmtcert.cer (provide path of the certificate)

9. Package(.cspkg) and configurations(.cscfg) will be uploaded to First Storage account
   - If you don't have storage create, you need to create one

10. Use Azure Storage Explorer to download the file from the Container


Method 2: Using Azure Get Package REST API
Ref: https://msdn.microsoft.com/en-us/library/azure/jj154121.aspx

There are two ways to authenticate against Azure Subscription
       - via Management Certificate(explained above)
       - via WAAD

If you want to authenticate to Azure Subscription using WAAD instead of Management Certificate,  below blog post has nicely outlined the steps
http://www.bradygaster.com/post/using-windows-azure-active-directory-to-authenticate-the-management-libraries

 

No comments:

Post a Comment