How do you install an exe file stored in Azure File shares on Azure VMs using DSC? - powershell

I have some .exe files which i need to install on VMs in azure using azure automation powershell DSC. Is this possible and how can it be done? The exe files are currently stored in an azure file share.

A similar question was asked here The answer provided was:
If you want to do the install the EXE remotely then the VM needs to be configured to allow for remote management - you can do this via WinRM. See: https://www.penflip.com/powershellorg/secrets-of-powershell-remoting/blob/master/accessing-remote-computers.txt and http://tarkus.me/post/64761019099/windows-azure-vms-remote-management
Setting this up is non-trivial (you need to ensure it's secure). You could also try adding an VM extension to the VM that will do the copy. Since the VM is already provision I think the only option here would be to use DSC though I've never added a DSC extension to a VM post-provisioning, it should work. That would require authoring and staging a DSC script in addition to adding the extension but definitely less complex than enabling remote management.
You should also consider Azure automation, depending on how large scale is your automation projects are. You can find more info and tutorials here

Related

Automatically install Python on self hosted agents in Azure Pipelines

In the FAQ of the UsePython task doc it says that in order to use the UsePython task, you have to manually install the required version of Python under a specific folder structure in the Agent.ToolDirectory folder.
This is pretty daunting. Isn't there a way to configure Azure to a specific source (such as Artifactory instance or something like this) and tell it to install it from there?
If you use self hosted agents on VM's you enter the area where tools for configuration managment could be handy. So you can use:
powershell desired state configuration install python quick tutorial
ansible
chef
However, there is no simple way to acheive this. You can do it manually, or build a solution to handle software on your self hosted machines. You can also reuse repository for MS Hosted vm's and leverage this.

Is there any method for vm update in azure except update management tool in automation account

I need to develop powershell script for automating vm patches updating in azure. I know we can do it by using azure update management but is there any other way to do it? I'm new to it please help.
You could refer to this Virtual Machines - Update to update a virtual machine.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}?api-version=2020-06-01
In addition, we could also do this in the UI and capture the request URL and request Body in the Network via F12, then convert it to power shell script.
As per this Microsoft Q&A platform question, you may use PSWindowsUpdate powershell module cmdlets.
And, if you are looking for a way to implement a way by removing dependency on Azure Automation and Azure Log Analytics then check Automatic VM guest patching (Preview).
Also, I would love to know the reason for trying to manually develop script for automating VM patches when the same is already available to us in the form of Update management solution (that is integrated with Azure Automation and Azure Log Analytics).

Run Custom Script Extension Against Azure App Service

I am able to execute Custom Script Extensions against VMs using Set-AzureRmVMCustomScriptExtension and noticed that Azure App Services have Extensions listed as one of their options:
Extensions add functionality to your App Service. Click add to see the
list of available extensions.
What I would like to achieve is running some PowerShell against the VM hosting an App Service, but can't locate a Resource Manager cmdlet like Set-AzureRmVMCustomScriptExtension. An example is modifying the security of some of the directories of IIS hosting my website to disable anonymous access, and adding a few files to directories of my website. I am able to achieve this using a script against an IaaS Azure VM and am wondering if this will work against an App Service, and if so, how to target the VM of the App Service.
Key actions I take as part of this PowerShell is:
Disable anonymous access to certain directories in IIS
Limit access to certain file types
Edit existing XML files
Add new files to a directory (downloaded via CDN)
Logging into the Kudu interface (Mysite.scm.azure...) I am able to execute some PowerShell via the debug Console option, so I am thinking there has to be a way to run PowerShell via Azure Automation beyond the AzureRm.Websites cmdlets as with the Kudu PowerShell interface I was able to create directories with a plain old create-item cmdlet.
App Service is very different from VM hosting. In App Service, you never get direct access to the VM, and there is generally no way that you can run any script that affects the VM at a global level.
Instead, you are only able to affect the files that make up the Web App, and everything runs under a sandbox.

PowerShell DSC for client machines?

I am trying to use PowerShell DSC to deploy our software to client PCs; in most of the DSC tutorials or examples that I have seen, DSC seems to be used to deploy server software.
Does it make sense to use DSC for client PCs?
Notes :
I have already tried deployment with the classic .MSI packages; it doesn't work very well in our case for various reasons, and we would really benefit from the fact that DSC deployments can automatically "heal" in case of problems.
I use puppet to deploy the server-side software; it works fine, but puppet doesn't seem to be a good fit for client PCs (therefore PowerShell DSC).
DSC does ship in the client. When we say DSC is for configuring servers it means we will target scenarios specific to the server. However, with the existing features if you can solve a scenario in client, feel free to do so.
Dsc is oriented for server , where a configuration is global for the system (like a database , web or file server).
Users can have differents settings on the same machine , dsc is not the best solution to deal with that usecase.
Anyway, for package deployment you can look at Oneget or Chovolatey ;)

Azure - SSMS - PowerShell

I am working through my first Azure HDInsight tutorial. Can I do this without installing Azure Remote PowerShell on my local computer?
Can I use SSMS (2008R2) to run the PowerShell? My first attempt at that led me down the path of using a Database in Azure, but I do not think that is what I want to do (the tutorial describes setting Storage (not a Database) and then an HDInsight instance to interact with that Storage).
I am doing this tutorial: http://www.windowsazure.com/en-us/manage/services/hdinsight/get-started-hdinsight/
Thank you.
While you can use SQL Server and HDInsight together as part of a full pipeline, for the purposes of the getting started tutorial you want to think of them as two very different things.
The Storage referred to, is a standard Windows Azure Storage account, based on blobs. These then form a backing file system for the HDInsight cluster.
As far as using PowerShell goes, it is definitely the best, and easiest way to submit jobs to an HDInsight cluster. I would also recommend using a regular PowerShell console, or the PowerShell ISE to work with HDInsight as well, rather than the one available through SSMS, since the SSMS version won't load all the Azure modules by default.
There are other ways to submit jobs if PowerShell is not your thing (if you are on OS X or Linux for instance). You can use the REST API provided by WebHCAT (documentation). If you're on Windows, and prefer C# to PowerShell, you can also use the Windows Azure HDInsight Management Client from the Microsoft Hadoop SDK to submit jobs (available on codeplex and nuget). These will need you to break out Visual Studio and write a short console program to submit your job, so may be a bit heavy unless you're doing full on C# streaming Map Reduce, and so are already there.
If you're after a GUI based approach to job submission to HDInsight, you're out of luck at the moment, but your might like to check out what my team is working on at Red Gate, which will help you with submitting Hive and Pig jobs.