Reputation: 79
I use PowerShell Script to the start azure automation which deallocated vm on name:
$clientID = "..."
$key = "..."
$SecurePassword = $key | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $clientID, $SecurePassword
Add-AzureRmAccount -Credential $cred -Tenant "..." -ServicePrincipal
$params = @{"RESOURCEGROUPNAME" = "..."; "VMNAME" = $env:computername}
Start-AzureRmAutomationRunbook -ResourceGroupName "..." -AutomationAccountName "..." -Name "StopAzureV2Vm" -Parameters $params
but from Jule/22 command Add-AzureRmAccount ... started throw error:
Add-AzureRmAccount : AADSTS1002016: You are using TLS version 1.0, 1.1 and/or 3DES cipher which are deprecated to improve the security posture of Azure AD. Your TenantID is: 7441e116-ef50-4bf6-a98f-1fa0671ccfb5. Please refer to https://go.microsoft.com/fwlink/?linkid=2161187 and conduct needed actions to remediate the issue. For further questions, please contact your administrator.
please help rewrite my code for new Requirements?
Upvotes: 0
Views: 327
Reputation: 4786
You can follow the below ways to fix the issue:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
Refer the MSDOC to solve the TLS 1.0 issues
Upvotes: 1