none
ARM Templates with DSC extensions: push content to deployed VM

    Question

  • Hi,

    I'm experimenting with an ARM template that includes a DSC configuration using a configuration that sets up a VM with IIS.

    I was looking into possible ways to get the static content of the small website deployed on the VM. I'm testing this on a small site that is not supported with an Octopus deploy like most other sites in the organisation do. There are a lot of options I guess, some of which are:

    1. Octopus deploy via the Octopus DSC resource is, for the time being, out in this particular scenario, because the deploy is not set up (yet), and I would like to evaluate the other options. For other sites we support, Octopus is the most logical option, and is actually used.
    2. I don't want to go to a DSC pull server scenario because this is overkill in the current context.
    3. Use Start-DscConfiguration from the command line, instead of pushing it with the ARM template. Not exactly what I'm looking for, because I want to keep freedom in how the ARM template will eventually be deployed (e.g. via the portal).
    4. Put the content in blob storage, pull it out in a DSC script resource in the configuration, and extract it in the desired location.
    5. Include it in the zip file that is generated based on the DSC configuration and pushed to blob storage, and then use e.g. a DSC script resource to pick it up, and extract it to the desired location.

    And then finally the question :-):

    I was wondering if the last option in the list is actually a feasible one, e.g. is there any way to know inside of a DSC script resource script what the location is where the DSC extension zip package is extracted to? I'm aware that this last option is not one that is likely to be used a lot, but still I would like to find out if this is actually possible.

    Thanks,

    Serge

    Monday, January 9, 2017 9:27 AM

Answers

  • Here'w what we do in a similar situation:

    • Upload our DSC files, and any content files (in this case your website content) to Blob storage, locked down to require a SAS key
    • Deploy VM using an ARM script, in the ARM script setup the Azure DSC extension to get the DSC files from blob storage and run them on the VM.
    • In the DSC script us the xRemoteFile resource to download the content zip file from blob storage to a specific location
    • Use the Archive DSC resource to extract the content to the require location, in this case your website location

    This works very well, and has the benefit of if you did want to add in Octopus deployment later it is easy to do. We have Octopus perform the upload of the DSC and content files to blob storage, from our Git repo at deployment time (so we always use the right version) and then trigger the ARM deployment.

    • Marked as answer by sergevm Tuesday, January 10, 2017 12:56 PM
    Monday, January 9, 2017 10:00 AM

All replies

  • Here'w what we do in a similar situation:

    • Upload our DSC files, and any content files (in this case your website content) to Blob storage, locked down to require a SAS key
    • Deploy VM using an ARM script, in the ARM script setup the Azure DSC extension to get the DSC files from blob storage and run them on the VM.
    • In the DSC script us the xRemoteFile resource to download the content zip file from blob storage to a specific location
    • Use the Archive DSC resource to extract the content to the require location, in this case your website location

    This works very well, and has the benefit of if you did want to add in Octopus deployment later it is easy to do. We have Octopus perform the upload of the DSC and content files to blob storage, from our Git repo at deployment time (so we always use the right version) and then trigger the ARM deployment.

    • Marked as answer by sergevm Tuesday, January 10, 2017 12:56 PM
    Monday, January 9, 2017 10:00 AM
  • Thanks, that's the scenario '4' indeed. 
    Monday, January 9, 2017 10:13 AM
  • Did you by any chance have issues with winRM? 

    I get an exception stating that winRM cannot process the request ...

    Monday, January 9, 2017 2:17 PM
  • No, no issues with that at all, at what point in the process are you getting the error?
    Monday, January 9, 2017 2:21 PM
  • My guess is that this happens when xRemoteFile is executed. 
    Monday, January 9, 2017 3:14 PM
  • What do you DSC extension logs say? I'm going to need some more info to help you out.
    Monday, January 9, 2017 4:06 PM
  • The issue seems unrelated. Because of the resource group being messed up when I tried to move resources to another group, I restarted today, and the issue has gone. Thanks!
    Tuesday, January 10, 2017 12:56 PM