Here's a function I use quite a lot. Now, I know it's old-world (ASM rather than ARM) in terms of Azure, but I still have a lot of old-world, cloud services. In fact, a lot of them were built by the following script and the function should be considered as partner code.


Build an Active Directory Forest in Microsoft Azure (IaaS)



function Start-AzureCloudService {

    #Define and validate mandatory parameters
          #The Cloud Service name, e.g. IANCLOUD
          [ValidateScript({Get-AzureService -ServiceName $_})] 

          #Just start the DCs

        Get-AzureVM -ServiceName $ServiceName | Where-Object {$_.Name -like "*DC0*"} | Start-AzureVM

        if (!$DcOnly) {
            Get-AzureVM -ServiceName $ServiceName | Where-Object {$_.Name -notlike "*DC0*"} | Start-AzureVM

You need to supply the cloud service name and whether you want to start just the DCs in the cloud service or all of the VMs. The way the DCs are found (and the fact the cloud service contains DCs) is the reason why this is a complementary function.

Comments (0)

Skip to main content