title: The term 'Get-AzureRmPolicyDefinition' is not recognized as the name of a cmdlet, function, script file, or operable program
body: <p>I have problem with last task, assign policy:</p>
  
  <p><a href="https://i.stack.imgur.com/yAKRt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yAKRt.png" alt="enter image description here"></a></p>
  
  <p>Module <strong>AzureRM</strong> which contains Resources namespace (with Get-AzureRmPolicyDefinition) should be already included, right?
  <a href="https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Resources/Commands.Resources/help/Get-AzureRmPolicyDefinition.md" rel="nofollow noreferrer">https://github.com/Azure/azure-powershell/blob/preview/src/ResourceManager/Resources/Commands.Resources/help/Get-AzureRmPolicyDefinition.md</a></p>
  
  <p>So why I have this error message?</p>
  
  <blockquote>
    <p>The term 'Get-AzureRmPolicyDefinition' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/nAyCO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nAyCO.png" alt="enter image description here"></a></p>
  
  <p>When I add to PowerShell task line:</p>
  
  <blockquote>
    <p>Install-PackageProvider -Name NuGet -Force -Scope CurrentUser</p>
    
    <p>Install-Module -Name Az.Accounts -RequiredVersion 1.6.2 -Force -Scope CurrentUser -AllowClobber</p>
    
    <p>Install-Module -Name AzureRM.Resources -RequiredVersion 6.7.3 -Force -Scope CurrentUser -AllowClobber</p>
  </blockquote>
  
  <p>Then I will at the end get:</p>
  
  <blockquote>
    <p>Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.</p>
  </blockquote>
  
  <p>How to deal with that problem? </p>
  
  <pre><code>2020-01-23T12:42:46.1108266Z ##[section]Starting: Assign Azure Policy
  2020-01-23T12:42:46.1190930Z ==============================================================================
  2020-01-23T12:42:46.1191016Z Task         : Azure PowerShell
  2020-01-23T12:42:46.1191088Z Description  : Run a PowerShell script within an Azure environment
  2020-01-23T12:42:46.1191160Z Version      : 4.159.7
  2020-01-23T12:42:46.1191219Z Author       : Microsoft Corporation
  2020-01-23T12:42:46.1191280Z Help         : [Learn more about this task](https://go.microsoft.com/fwlink/?LinkID=613749)
  2020-01-23T12:42:46.1191368Z ==============================================================================
  2020-01-23T12:42:48.5385840Z ##[command]Import-Module -Name C:\Modules\az_3.1.0\Az.Accounts\1.6.4\Az.Accounts.psd1 -Global
  2020-01-23T12:42:50.3192937Z ##[warning]Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide
  2020-01-23T12:42:55.2184342Z ##[command]Clear-AzContext -Scope Process
  2020-01-23T12:42:56.2685211Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
  2020-01-23T12:42:56.8285933Z ##[command]Connect-AzAccount -ServicePrincipal -Tenant *** -Credential System.Management.Automation.PSCredential -Environment AzureCloud
  2020-01-23T12:42:57.9191448Z ##[command] Set-AzContext -SubscriptionId 78afced4-1c58-4e66-8242-c042890d34c3 -TenantId ***
  2020-01-23T12:42:58.5652039Z ##[command]&amp; 'D:\a\_temp\743dfd85-b908-48ee-9a00-e0ee97b44c8a.ps1' 
  2020-01-23T12:42:59.9241324Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
  2020-01-23T12:43:00.1484807Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
  2020-01-23T12:43:00.6509257Z ##[error]Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.Commands.ResourceManager.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
  2020-01-23T12:43:00.6856188Z ##[section]Finishing: Assign Azure Policy
  </code></pre>