azure-powershell

Create a Application in Azure AD with Azure PowerShell Certificate authentication

吃可爱长大的小学妹 提交于 2020-01-06 19:56:46
问题 I was trying to Create a Application in Azure AD with Azure PowerShell Certificate authentication, below is the Powershell snippet: Login-AzureRmAccount $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate("PATH_TO_CER_FILE") $key = [System.Convert]::ToBase64String($cert.GetRawCertData()) $app = New-AzureRmADApplication -DisplayName "SetupTet4" -HomePage "http://localhost" -IdentifierUris "http://localhost" -KeyValue $key -KeyType AsymmetricX509Cert New

Create a Application in Azure AD with Azure PowerShell Certificate authentication

白昼怎懂夜的黑 提交于 2020-01-06 19:56:03
问题 I was trying to Create a Application in Azure AD with Azure PowerShell Certificate authentication, below is the Powershell snippet: Login-AzureRmAccount $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate("PATH_TO_CER_FILE") $key = [System.Convert]::ToBase64String($cert.GetRawCertData()) $app = New-AzureRmADApplication -DisplayName "SetupTet4" -HomePage "http://localhost" -IdentifierUris "http://localhost" -KeyValue $key -KeyType AsymmetricX509Cert New

Automate Authentication to Azure as Service Principal using Windows Powershell

纵饮孤独 提交于 2020-01-06 08:12:59
问题 I need to use Powershell for some automated Jenkins jobs. To do the work, I need to authenticate as a Service Principal in a non-interactive fashion. With the Azure CLI, this can be accomplished non-interactively using the following command: az login --service-principal -u "$client_id" -p "$client_secret" -t "$tenant_id" However, accomplishing this using the Connect-AzAccount cmdlet for Powershell is proving to be tough. Is there anyway to achieve the same result as above using a Powershell

Create HDCluster using powershell

孤街醉人 提交于 2020-01-06 06:53:07
问题 I am trying to create cluster using powershell. Here is script I am executing: $containerName = "hdfiles" $location = "Southeast Asia" $clusterNodes = 2 $userName = "HDUser" #Generate random password $rand = New-Object System.Random $pass = "" $pass = $pass + [char]$rand.next(97,121) #lower case $pass = $pass + [char]$rand.next(48,57) #number $pass = $pass + [char]$rand.next(65,90) #upper case $pass = $pass + [char]$rand.next(58,62) #special character 1..6 | ForEach { $pass = $pass + [char]

How to find Azure VM applied backup protection policy name via Powershell

血红的双手。 提交于 2020-01-06 06:06:22
问题 How to find which azure backup protection policy applied on specific Azure virtual machine via Powershell Get- AzureRmRecoveryServicesBackupProtectionPolicy asking for policyname but there are many policy under one service vault. thanks! 回答1: You could use following script. ##Replace Recovery service vault name Get-AzureRmRecoveryServicesVault -Name "shui" | Set-AzureRmRecoveryServicesVaultContext ##FriendlyName is your Azure VM name $namedContainer=Get-AzureRmRecoveryServicesBackupContainer

Azure Service principal insufficient permissions to manage other service principals

百般思念 提交于 2020-01-06 06:03:43
问题 I'm able to create a service principal either using Azure or from the portal console with the az cli. az ad sp create-for-rbac --name "myspuser" --password "adfhrrreeuwrgwejdfgds" Then I assign the owner role at subscription level and log-in in a powershell console. Login-AzureRmAccount -Credential (New-Object System.Management.Automation.PSCredential ('a92b2ea2-aaaa-0000-0a0a-1238ec953226', $(ConvertTo-SecureString 'abcewior23h23ius' -AsPlainText -Force))) -ServicePrincipal -TenantId

Import-AzurePublishSettingsFile throws CryptographicException

感情迁移 提交于 2020-01-05 04:55:19
问题 Import-AzurePublishSettingsFile throws CryptographicException. We uploaded a management certificate and all the Azure APIs are returning results but Import-AzurePublishSettingsFile throws following exception: importSystem.Security.Cryptography.CryptographicException: An internal error occurred. at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] awData, IntPtr password,

Add-AzureRmAccount : Sequence contains no elements

被刻印的时光 ゝ 提交于 2020-01-03 17:12:34
问题 I'm trying to validate a script to connect to Azure via PowerShell. $username = "asdfasdf" $password = "asdfasdf" $secstr = New-Object -TypeName System.Security.SecureString $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)} $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr Add-AzureRmAccount -Credential $cred Select-AzureRmSubscription -SubscriptionId asdfasdf Full error message: Add-AzureRmAccount : Sequence contains no

Get-AzureRmAppServicePlan and Get-AzureRmWebApp return exceptions in Runbook

隐身守侯 提交于 2020-01-03 17:04:17
问题 I'd like to get all properties with Get-AzureRm* commands in Automation Runbook, but the followings return exception. How to code so as to work these commands properly? Returns exception Get-AzureRmAppServicePlan Get-AzureRmWebApp Returns expected result Get-AzureRmStorageAccount input - Powershell Runbook (not Workflow) Write-Output $PSVersionTable $resourceGroupName = "(snipped)" $appServicePlans = Get-AzureRmAppServicePlan -ResourceGroupName $resourceGroupName $Cred = Get

How to check if a blob already exists in Azure blob container using PowerShell

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 13:05:16
问题 I have a Windows PowerShell script that uploads a file to my Azure Blob Storage. I want the file only to upload if it doesn't already exists in the container. How do I check if the blob already exists ? I tired to use Get-AzureStorageBlob but if the blob doesn't exists, it returns an error. Should I parse the error message to determine that the blob doesn't exists ? This doesn't seem right... And Set-AzureStorageBlobContent is asking for a confirmation when the blob exists. Is there a way to