{"id":14063720,"url":"https://github.com/PowerShellCrack/MyAzureProfileScript","last_synced_at":"2025-07-29T16:31:18.590Z","repository":{"id":111449952,"uuid":"321694051","full_name":"PowerShellCrack/MyAzureProfileScript","owner":"PowerShellCrack","description":"Profile script for your system to simply manage VMs in Azure","archived":false,"fork":false,"pushed_at":"2022-01-11T00:32:26.000Z","size":1455,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-07T07:13:16.661Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PowerShellCrack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-12-15T14:34:31.000Z","updated_at":"2023-08-09T19:49:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"93d9a707-5adb-40b8-80ee-b16e1b300055","html_url":"https://github.com/PowerShellCrack/MyAzureProfileScript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShellCrack%2FMyAzureProfileScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShellCrack%2FMyAzureProfileScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShellCrack%2FMyAzureProfileScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShellCrack%2FMyAzureProfileScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PowerShellCrack","download_url":"https://codeload.github.com/PowerShellCrack/MyAzureProfileScript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228028618,"owners_count":17858412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:03:28.501Z","updated_at":"2024-12-04T01:31:21.351Z","avatar_url":"https://github.com/PowerShellCrack.png","language":"PowerShell","readme":"# MyAzureProfileScript\n\nA Profile script for your admin system to manage VMs in multiple (or singular) Azure tenants. I have multiple tenants and need to start them up based on what I am testing.\n\n## Customize your resources\n\nThere are some areas that need to be modified. The very first function, __Set-MyAzureEnvironment__, is where the Azure tenants are configured; add the tenant info to each site. Review Lines 64-75\n\n```powershell\n#My Azure Site A lab\n'Resource Tenant' {\n        $myTenantID = '\u003cyour tenant ID\u003e'\n        $mySubscriptionName = '\u003cyour subscription name\u003e'\n        $mySubscriptionID = '\u003cyour subscription ID\u003e'\n        $myResourceGroup = '\u003cyour resource group\u003e'\n    }\n#My Azure Site B lab\n'Services Tenant' {\n        $myTenantID = '\u003cyour tenant ID\u003e'\n        $mySubscriptionName = '\u003cyour subscription name\u003e'\n        $mySubscriptionID = '\u003cyour subscription ID\u003e'\n        $myResourceGroup = '\u003cyour resource group\u003e'\n    }\n```\n\nMake sure to update _[ValidateSet()]_ in the param section (line 25) as well if you add new or change environments names.\n\n```powershell\n[ValidateSet('Resource Tenant','Services Tenant')]\n```\n\nI have the script installs and updates the required modules. It currently monitors these modules:\n\n- Az\n- Azure\n- AzureAD\n- Az.Security\n\nI would recommend keeping the above\n\nOn line 29, you can edit it and add more if you like. :\n\n```powershell\n#set this to what you want\n$Checkmodules = @('Az','Az.Security','Azure','AzureAD')\n```\n\n## Call the script\n\nCopy this script to your __C:\\Users\\\\\\\u003cuserprofile\u003e\\Documents\\WindowsPowerShell__ folder and relaunch Windows PowerShell.\n\u003e __Keep in Mind__: If you already have a profile script, make sure you make a backup or integrate your code into this one.\n\n I've added a check to see if the script is called directly and if it is, it exits the script; this resolves issues with services calling powershell or VS code calling the script  each time its launched\n\nThe only command you will need run is:\n\n- Start-MyLabEnvironment\n\nThis will set off a chain of events\n\nIf you have not specified the correct Azure Tenant info, You will also be presented with a grid output to verify the subscription list.\n\nAlso the first time you connect to Azure using PowerShell, an identity file is creating in your profile. Being a nerd, the script parses that file to look for the authenticated username's first name and output a voice such as: \"Good morning Dick, Please wait while I check for installed modules...\"\n\nHowever you can disable it if you set line 14 to\n\n```powershell\n$VoiceWelcomeMessage = $false\n\n$DefaultVoiceProfile = 'Female'\n```\nthere are othere global settings that can be changes for more automation and features (lines 18-24)\n\n```powershell\n$global:MyLabTag = 'StartupOrder'\n\n$global:MyAzLabTenant = 'Resource Tenant'\n\n$global:MyMDTSimulatorPath = 'C:\\MDTSimulator'\n\n$global:MyDeploymentShare = \"\\\\$env:ComputerName\\Deploymentshare$\"\n```\n\n## Future changes\n- I plan on making more voice commands within the functions; yes I know what your thinking...NERD ALERT!!\n\n## Screenshots\n\nThis is what the startup looks like.\n![Console](.images/AzureEnvironment.PNG)\n\nNSG assigned to __subnet__ and only enabled JIT for VMs with public IP's\n![NSG On Subnet](.images/status.png)\n\nNSG assigned to VMs __nic__ and only enabled JIT for the ones with public IP's\n![NSG on NIC](.images/startedvms.png)\n\n## Functions Included\n\nTHe functions are the main functions to manage your virtual environment. However there are a lot of other functions available in this script:\n\nUPDATE 06/11/2021: All command verbs will start with _My_\n\n\n- **Start-MyLabEnvironment** --\u003e Uses global variables start up lab. This will include starting Azure and Hyper-V labs and making sure Azure gateway IP is accurate. Only starts VM's with order tag specified in global variable. Set tag in notes of Hyper-V VM (eg: StartupOrder: 1)\n- **Start-MyAzureEnvironment** --\u003e Underlying function that will start the VM's in Azure environment\n- Start-MyAzureVM\n- Start-MyElevatedProcess\n- Start-MyVSCodeInstall\n- Start-MyHyperVM\n- **Connect-MyAzureEnvironment** --\u003e Starts just the Azure lab,\n- Enable-MyAzureJitPolicy\n- Get-MyAzureNSGRules\n- Get-MyAzureUserName\n- Get-MyAzureVM\n- Get-MyHyperVM\n- Get-MyRandomAlphanumericString\n- Get-MyRandomSerialNumber\n- Get-MyRemoteDesktopData\n- Get-MyVolumeLevel\n- Install-MyLatestModule\n- Out-MyVoice\n- Restart-MyHyperV\n- Set-MyAzureEnvironment\n- Set-MyAzureJitPolicy\n- Set-MyVolumeLevel\n- Set-MyWindowPosition\n- Show-MyCommands\n- Stop-MyHyperVM\n- Test-MyVSCode\n- Test-MyVSCodeInstall\n\n\nInstead of calling _powershell_ise_ using the alias _ise_. In this profile I set the alias of **vsc** to call _Microsoft Visual Studio_\n","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPowerShellCrack%2FMyAzureProfileScript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPowerShellCrack%2FMyAzureProfileScript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPowerShellCrack%2FMyAzureProfileScript/lists"}