azure-powershell

Removing VHD's from Azure Resource Manager after removing VM

有些话、适合烂在心里 提交于 2019-12-14 01:15:58
问题 It was brought to my attention that, if you create a new VM and then delete it (and its associated resources), you do not in fact delete the corresponding VHD file -- that file is left in blob storage, blocking the provisioning of a new machine with the same hostname, and also costing real money for wasted and unused storage. I wish to delete the VHD's along with the VM's. Where can I find a good write-up of the current wisdom on how to deal with this? All I can find is references from before

How to list metric alerts in Azure with PowerShell

こ雲淡風輕ζ 提交于 2019-12-13 18:18:18
问题 Is it possible to list metric alerts in Azure with PowerShell? I could only find: Get-AzureRmAlertRule But that only gives me the "classic" alerts and not the metric alerts I have in the portal. I can get all the metric alerts through the API by using the metricalerts/listbyresourcegroup end-point. Anyone that has any idea on if it is possible to get them through a PowerShell script? 回答1: You could try using the generic Get-AzureRmResource cmdlet with a resource type filter, e.g. # Retrieve

Azure Powershell how to get running services of a VM via Runbook?

亡梦爱人 提交于 2019-12-13 17:58:02
问题 I'm trying to write an Azure Powershell Runbook that will start a VM, and then check if a windows service on the VM is running or not and start it. I can get the VM started, but enumerating the services isn't working. I'm brand new on Azure Runbooks so I could be doing something wrong. I limited the below code to only the Get-Service bit and not the VM starting. # Returns strings with status messages [OutputType([String])] param ( [Parameter(Mandatory=$false)] [String]

How do I properly use ForEach() statement of List?

拥有回忆 提交于 2019-12-13 17:31:27
问题 I'm confused what I'm doing wrong in ForEach method syntax of List? PS D:\ntt> $nicInfo.IpConfigurations.Count 2 PS D:\ntt> $nicInfo.IpConfigurations[0] PrivateIpAddressVersion Name Primary PrivateIpAddress PrivateIpAllocationMethod Subnet Name PublicIpAddress Name ProvisioningState ----------------------- ---- ------- ---------------- ------------------------- ----------- -------------------- ----------------- IPv4 ipconfig1 True 10.233.0.4 Dynamic Succeeded PS D:\ntt> $nicInfo

Resource Group Name cannot be Null?

北战南征 提交于 2019-12-13 09:01:47
问题 I have a script that suppose to convert 400 vms unmanaged disks into managed disks. Our azure infrastructure is built in such a way that naming conventions almost matches the names of the virutal machine or same how are likely the same, for example if I have a vm named E1PrGrp19VFe01 it resides in E1PrGrp19Rg resource group hence I am using below statement to store the name of the RG inside a variable like below: $VmCode = Read-Host "Partner/VM Code" (Will give a name of the VM) $Rg = Get

How to detach/dissociate public IP of ARM VM

寵の児 提交于 2019-12-13 07:33:11
问题 I have an ARM VM with a public IP. I want to detach/dissociate this public IP after my test. I can see there is an option using azure portal- I want to do the same thing using azure powershell. I tried finding azure cmdlets related to public IP but couldn't achieve it. If someone can give me some clue how this can be done ? 回答1: You need to get the Network Interface object and remove the Ip Address Id from it and push changes back to Azure. $nic = Get-AzureRmNetworkInterface -Name bla

ReservedIPs for Azure VMs in a single VNet/subnet

给你一囗甜甜゛ 提交于 2019-12-13 05:59:14
问题 I've 8 VMs (linux based) running a single VNet on Azure. If I've two VMs running a service on the same port which shows me machine status or shows some common details which is specific to the VM. Say for example VM-1 runs a service on 8080 port and same same service has been deployed on VM-2 which runs on the same port 8080. To access to a service running on port 8080 I am opening a port on VM-1 through end points. I am able to access 8080 from web browser through VM-1 using servicename

How to run Azure VM CustomScriptExtension as domain user? (part 2)

早过忘川 提交于 2019-12-13 05:14:27
问题 Updated to explain my root problem: If Azure has extensions for VM's, as they are being provisioned , to join a domain, and to run scripts, how can I run a script as a domain user? The script needs to be run as a domain user in order to access a file share to retrieve installation files and other scripts that are neither part of the VM template image nor can (reasonably) be uploaded to Azure blob storage and downloaded as part of provisioning. I split this question in two because the 2nd half

Using Powershell, how to you add a version to an azure api management API?

社会主义新天地 提交于 2019-12-13 04:27:58
问题 Using Powershell, how to you add a version to an azure api management API? Im using New-AzureRmApiManagementApi to create the API, and using version 5.1.2 of AzureRM.ApiManagement 回答1: To add the module version you can use the command Install-Module -Name AzureRM.ApiManagement -RequiredVersion 6.0.0 For further information check this link PowerShell gallery 回答2: I have implemented an Azure API Management Version Set under APIM via Azure REST API in PowerShell. With reference of Api-versioning

How to verify that Azure Reverse DNS is working properly?

雨燕双飞 提交于 2019-12-13 04:25:44
问题 I just got a static IP and ran the command below to get a reserved DNS: Set-AzureService -ServiceName "people-dns" -Description "people-dns reverse DNS" -ReverseDnsFqdn "people-dns.cloudapp.net." Now if I run Get-AzureService it shows: ReverseDnsFqdn : people-dns.cloudapp.net. How can I verify that it is working properly? (it would be nice to automate this test so I can know if it stops working too) UPDATE : I found web sites that can check like http://mxtoolbox.com but I like to know how