azure-powershell

Validate Azure Resource Group Exist or not

你。 提交于 2020-07-10 08:57:21
问题 I am trying to write to a powershell script to validate the Resource Group is exist or not. Conditions- Check the resource group (myrg) is already exist in azure subscription. If "condition 1" is FALSE then Create a Resource Group (myrg) Else append 2 digits to the Resource Group name. e.g. (myrg01) Check the (myrg01)resource group exist in azure subscription. If "condition 3" is FALSE then Create a Resource Group (myrg01) Else increment the last digit by one for Resource Group name. e.g.

How to get thumbprint of the certificate associated with a service principal using Powershell?

自闭症网瘾萝莉.ら 提交于 2020-06-29 05:12:20
问题 I have a certificate associated with a service principal in Azure AD. How can I get the certificate name or thumbprint associated with it using powershell? I have tried Get-AzureRmADServicePrincipalCredential , Get-AzureRmADSpCredential and Get-AzureADServicePrincipalKeyCredential commands but they return Key Identifier not thumbprint. Basically I want to recognize which certificate is associated with the principal before revoking it. 回答1: As @Stanley Gong mentioned, you can use MS Graph to

How to stop continuous and remove schedule from schedules web jobs in VSTS

房东的猫 提交于 2020-06-29 04:44:05
问题 In VSTS Release, how do I stop all continuous webjobs and remove schedule from triggered webjobs for specific deployment slot? scenario: I have a asp.net core web application with bunch of webjobs. Some of them are scheduled, some are continuous. In VSTS Release I deploy the webjobs together with web app to App Service using Web Deploy. However, in staging environment I don't want to run the webjobs, since they would interfere with production (the share the same database, etc). I guess I

Scale up and scale down of azure app service plan (Based on non-business hours) using azure automation script

房东的猫 提交于 2020-06-28 04:24:07
问题 I have to Scale up and scale down of azure app service plan (Based on non-business hours) using azure automation service. I have visited lot of websites but everywhere it is about scale out or increasing/decreasing the instance count. But my requirement is I want to change app service plan from S2 to S1 and vice versa based on timings. Please help me.... 回答1: this is what you are looking for: Set-AzureRmAppServicePlan -ResourceGroupName $ResourceGroupName -Name $ServicePlanName -Location

Getting null hash value while matching key using powershell

北城以北 提交于 2020-06-17 10:01:08
问题 I am trying to get the value of the key by matching key name(ignoring the white and character case). Code : $tagHash = (Get-AzResourceGroup -Name "twmstgmsnp").Tags Write-Host "Resource Group tags key : " $tagHash.Keys Write-Host "Resource Group tags value : " $tagHash.Values $ownervalue = $tagHash.GetEnumerator() | ? {($_.Key).ToString().Replace(' ','') -eq 'CreatedBy'} | % Value Write-Host "Resource Group CREATEDBY tag : " $ownervalue Result : Resource Group tags key : PURPOSE Created By

Powershell copy-item not working with azure automation

给你一囗甜甜゛ 提交于 2020-06-17 09:43:30
问题 Trying to execute ps script on azure vm's using azure automation using the approach defined at https://stackoverflow.com/a/62258063/1014275. Script below does copy files between azure vm's. Both Vm's are in same subnet and if we run the copy-item command from VM powershell it copies the files to target VM folder. The same script executes successfully with azure automation runbooks, but without copying files. Script used: Copy-Item -Path C:\folder\sample.txt -Destination \\\VmHostname\C$

ERROR: Get-AzApiManagementProduct : The pipeline has been stopped. when adding api management user in Azure PS Function

一笑奈何 提交于 2020-06-17 09:41:11
问题 I have been trying to automate the following script: https://docs.microsoft.com/en-us/azure/api-management/scripts/powershell-add-user-and-get-subscription-key?toc=/powershell/module/toc.json via Azure Functions. # generate a subscription key for the user to call apis which are part of the 'Starter' product $body = New-AzApiManagementSubscription -Context $context -UserId $user.UserId ` -ProductId $product.ProductId -Name $subscriptionName -State $subscriptionState } # Associate values to