About Me

My photo
I am an MCSE in Data Management and Analytics, specializing in MS SQL Server, and an MCP in Azure. With over 19+ years of experience in the IT industry, I bring expertise in data management, Azure Cloud, Data Center Migration, Infrastructure Architecture planning, as well as Virtualization and automation. I have a deep passion for driving innovation through infrastructure automation, particularly using Terraform for efficient provisioning. If you're looking for guidance on automating your infrastructure or have questions about Azure, SQL Server, or cloud migration, feel free to reach out. I often write to capture my own experiences and insights for future reference, but I hope that sharing these experiences through my blog will help others on their journey as well. Thank you for reading!

How to create a DSC File for Azure data Studio

launch powershell ISE in Administrator mode
save the file as InstallAzureDataStudio.ps1
if your  VM does not have PSDesiredStateConfiguration module installed

Go to Powershell console and execute below command

 PS C:\Users\admina> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

PS C:\Users\admina> Install-packageProvider -name Nuget

PS C:\Users\admina> Install-Module -Name xPSDesiredStateConfiguration -Force

PS C:\Users\admina>

go to the File "InstallAzureDataStudio.ps1"
 and execute this File, this DSC will create a Folder name xfer in C:\ drive.



 Configuration InstallAzureDataStudio
{
   Import-DscResource -ModuleName PSDesiredStateConfiguration
   #Import-DscResource -ModuleName xPSDesiredStateConfiguration

File SetupDir
 {
   Type = 'File'
   SourcePath = "C:\Users\admina\Downloads\azuredatastudio-windows-setup-1.17.0.exe" #This path should exists
   DestinationPath = 'C:\xfer\'
   Ensure = "Present"
  }

  Log AfterFileCopy
        {
            # The message below gets written to the Microsoft-Windows-Desired State Configuration/Analytic log
            Message = "Finished copying file to C:\xfer........ "
            DependsOn = "[File]SetupDir" # Depends on successful execution of the File resource.
        }
     

Package AzureDataStudioPackage
 {
  Ensure = "Present"
  Name = "Azure Data Studio"
  Path= "C:\xfer\azuredatastudio-windows-setup-1.17.0.exe"
  ProductId = ""
  Arguments = "/VERYSILENT"
  }
 
}


InstallAzureDataStudio



First Command
------------------------------
PS C:\Users\admina> C:\xfer\InstallAzureDataStudio.ps1


    Directory: C:\Users\admina>InstallAzureDataStudio


Mode                LastWriteTime         Length Name                                                                             
----                -------------         ------ ----                                                                             
-a----        4/30/2020   6:46 AM           3060 localhost.mof


it has created .mof file in C:\Users\admina

Second Command
------------------------------
PS C:\Users\admina> Start-DscConfiguration -Path "C:\Users\admina\InstallAzureDataStudio\InstallAzureDataStudio" -Force -Wait -Verbose

output:-

VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSC
LocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer rak-desc-test with user sid S-1-5-21-271070641-441374908-1635702522-500.
VERBOSE: [rak-desc-test]: LCM:  [ Start  Set      ]
VERBOSE: [rak-desc-test]: LCM:  [ Start  Resource ]  [[File]SetupDir]
VERBOSE: [rak-desc-test]: LCM:  [ Start  Test     ]  [[File]SetupDir]
VERBOSE: [rak-desc-test]:                            [[File]SetupDir] The destination object was found and no action is required.
VERBOSE: [rak-desc-test]: LCM:  [ End    Test     ]  [[File]SetupDir]  in 0.0160 seconds.
VERBOSE: [rak-desc-test]: LCM:  [ Skip   Set      ]  [[File]SetupDir]
VERBOSE: [rak-desc-test]: LCM:  [ End    Resource ]  [[File]SetupDir]
VERBOSE: [rak-desc-test]: LCM:  [ Start  Resource ]  [[Package]AzureDataStudioPackage]
VERBOSE: [rak-desc-test]: LCM:  [ Start  Test     ]  [[Package]AzureDataStudioPackage]
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Validate-StandardArguments, Path was C:\setup\a
zuredatastudio-windows-setup-1.17.0.exe
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The path extension was .exe
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Ensure is Present
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] product installation cannot be determined
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] product as boolean is False
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The package Azure Data Studio is not installed
VERBOSE: [rak-desc-test]: LCM:  [ End    Test     ]  [[Package]AzureDataStudioPackage]  in 0.0150 seconds.
VERBOSE: [rak-desc-test]: LCM:  [ Start  Set      ]  [[Package]AzureDataStudioPackage]
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Validate-StandardArguments, Path was C:\setup\a
zuredatastudio-windows-setup-1.17.0.exe
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The path extension was .exe
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Ensure is Present
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] product installation cannot be determined
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] product as boolean is False
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The package Azure Data Studio is not installed
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Validate-StandardArguments, Path was C:\setup\a
zuredatastudio-windows-setup-1.17.0.exe
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The path extension was .exe
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Package configuration starting
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The binary is an EXE
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Starting C:\setup\azuredatastudio-windows-setup
-1.17.0.exe with /VERYSILENT
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Starting process C:\setup\azuredatastudio-windo
ws-setup-1.17.0.exe with arguments /VERYSILENT
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] The machine requires a reboot
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Package has been installed
VERBOSE: [rak-desc-test]:                            [[Package]AzureDataStudioPackage] Package configuration finished
VERBOSE: [rak-desc-test]: LCM:  [ End    Set      ]  [[Package]AzureDataStudioPackage]  in 23.9840 seconds.
VERBOSE: [rak-desc-test]: LCM:  [ End    Resource ]  [[Package]AzureDataStudioPackage]
VERBOSE: [rak-desc-test]:                            [] A reboot is required to progress further. Please reboot the system.
WARNING: [rak-desc-test]:                            [] A reboot is required to progress further. Please reboot the system.
VERBOSE: [rak-desc-test]: LCM:  [ End    Set      ]
VERBOSE: [rak-desc-test]: LCM:  [ End    Set      ]    in  24.1710 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 25.696 seconds

PS C:\Users\admina>

you will observe Azure data studio has successfully been installed and you will find the same in control panel.

Go to C:\Program Files\Azure Data Studio and launch azuredatastudio.exe


Thanks for Reading..

No comments: