azure-powershell

Listing all azure vm belonging to particular subnet

女生的网名这么多〃 提交于 2021-02-10 14:22:57
问题 I want to list all azure vms in a particular subnet. I don't know how to write a PowerShell script for this. I am trying the below but it's not giving the desired output. My desired output- All VMs belonging to subnet having ip 10.87.00.01...10.87.99.99 should get listed in my text file subnet_VM.txt $tgtIP = "10.87.xx.xx" $vms = Get-AzureVM foreach($vm in $vms) { $vmIP = (Get-AzureVM -ServiceName $vm.ServiceName –Name $vm.Name).IpAddress foreach($ip in $vmIP) { if($ip -like '$tgtIP*') { $vm

Listing all azure vm belonging to particular subnet

房东的猫 提交于 2021-02-10 14:22:16
问题 I want to list all azure vms in a particular subnet. I don't know how to write a PowerShell script for this. I am trying the below but it's not giving the desired output. My desired output- All VMs belonging to subnet having ip 10.87.00.01...10.87.99.99 should get listed in my text file subnet_VM.txt $tgtIP = "10.87.xx.xx" $vms = Get-AzureVM foreach($vm in $vms) { $vmIP = (Get-AzureVM -ServiceName $vm.ServiceName –Name $vm.Name).IpAddress foreach($ip in $vmIP) { if($ip -like '$tgtIP*') { $vm

Listing all azure vm belonging to particular subnet

和自甴很熟 提交于 2021-02-10 14:22:09
问题 I want to list all azure vms in a particular subnet. I don't know how to write a PowerShell script for this. I am trying the below but it's not giving the desired output. My desired output- All VMs belonging to subnet having ip 10.87.00.01...10.87.99.99 should get listed in my text file subnet_VM.txt $tgtIP = "10.87.xx.xx" $vms = Get-AzureVM foreach($vm in $vms) { $vmIP = (Get-AzureVM -ServiceName $vm.ServiceName –Name $vm.Name).IpAddress foreach($ip in $vmIP) { if($ip -like '$tgtIP*') { $vm

Getting list of NSG and corresponding Subnet or NIC

狂风中的少年 提交于 2021-02-10 11:43:30
问题 Thanks in advance. I'm working on Azure PowerShell Script which will get all the NSG and finds whether it is attached to NIC or Subnet and give the name of the same in CSV. I'm stuck in parsing the NSG as it has property SubnetsText which outputs the data in below format. I'm trying to parse it using substring method but it did not work. Anybody tried this before? [ { "TapConfigurations": [], "HostedWorkloads": [], "Id": "/subscriptions/xxxx-xxxx-xxx-xxx-xxxxxx/resourceGroups/vm-test-group

How to setup oauth2AllowIdTokenImplicitFlow in azure AD application from console?

元气小坏坏 提交于 2021-02-08 11:21:34
问题 Is there any way to change property oauth2AllowIdTokenImplicitFlow in azure AD application via Azure CLI or Azure PowerShell? 回答1: The built-in Powershell or CLI does not support to set the oauth2AllowIdTokenImplicitFlow currently. Also, it seems the property just could be found in the manifest of the AD App, I could not find it in any doc(including the MS Graph or Azure AD Graph). But per my test, you could set the oauth2AllowIdTokenImplicitFlow via Azure AD Graph API. There are two ways for

What permissions does an Azure service principal need to call the New-AzSubscriptionAlias PowerShell function?

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-29 06:43:54
问题 I'm trying to create subscriptions through an Azure DevOps pipeline on a hosted agent running as a service principal and am receiving the error: New-AzSubscriptionAlias: /home/vsts/work/1/s/Azure.Automation/Subscriptions/Create-AzureSubscription.ps1:190 Line | 190 | $subscription = New-AzSubscriptionAlias ` | ~~~~~~~~~~~~~~~~~~~~~~~~~ | Operation returned an invalid status code 'Unauthorized' How do I grant the service principal the required access? 回答1: As it is written here in

Passing parameter to script from Invoke-AzVMRunCommand

半城伤御伤魂 提交于 2021-01-29 05:18:35
问题 I trying to execute the Invoke-AzVMRunCommand to execute a PS function that accept parameters. The code below shows call to the Invoke-AzVMRunCommand $runcmdparameters=@{ "VolumeLable"="sdsd"; "azurelun"="1,3,4" } Invoke-AzVMRunCommand -ResourceGroupName $ServerResourceGroupName -VMName $VMVame -ScriptPath "c:\Configurestorage.ps1" -CommandId 'RunPowerShellScript' -Parameter $runcmdparameters -Verbose The PS Script that I need to execute on the server is function Configure-Storage { Param(

Is it possible to do swap, start, stop slots in cloud service classic, on azure devops?

给你一囗甜甜゛ 提交于 2021-01-29 03:10:42
问题 I do ci/cd to Cloud Service(classic) with azure devops . I have steps like start or stop and swap slots in this Cloud Service. I thought I can use PowerShell for these goals. In the beginning, I tried Azure PowerShell job. Unfortunately, I have not found the required commands in Az and azureRM modules. So I decided to use just PowerShell job, where I install the Azure module and I want to use these commands Start-AzureService and Stop-AzureService . Is it the right way? Or is there something

Connect-AzAccount without prompt

北城余情 提交于 2021-01-28 19:01:45
问题 I am trying to login into Azure Portal by using Connect-AzAccount This code asks me for a prompt which I don't want, can we Auto login by using some simple config script. 回答1: As Joy said, you could login with the user account by credential which will no prompt, make sure your account doesn't enable the MFA. $User = "xxx@xxxx.onmicrosoft.com" $PWord = ConvertTo-SecureString -String "<Password>" -AsPlainText -Force $tenant = "<tenant id>" $subscription = "<subscription id>" $Credential = New

Is there a PowerShell equivalent to “az rest”?

点点圈 提交于 2021-01-28 13:51:40
问题 I recently discovered the az rest command, which allows me to perform authenticated REST commands, without having to worry about acquiring tokens. https://www.codeisahighway.com/native-azure-rest-api-calls-now-available-in-azure-cli-2-0-67/ az rest --method patch --url "https://graph.microsoft.com/v1.0/users/johndoe@azuresdkteam.onmicrosoft.com" --body "{\"displayName\": \"jondoe2\"}" Is there an equivalent in Azure Powershell? I need to do a call which is not available via any of the AzAd...