I'm attempting to enable accelerated networking in Azure from the Azure Powershell Az module. However, I get an error stating that 'No registered resource provider found for location "my location" and API version "2019-07-01"'
I've found that the latest API version available is 2019-06-01. I was able to get a list of API versions, but they are in date format and the Az Install-Module seems to only accept numbers such as 2.2.0.
((Get-AzResourceProvider -ProviderNamespace Microsoft.Network).ResourceTypes | Where-Object ResourceTypeName -eq networkInterfaces).ApiVersions
The code that generates the error:
$nic = Get-AzNetworkInterface -ResourceGroupName "myResourceGroupName" -Name "myNicName"
I'm looking for a way via Az powershell cmdlets or a web site reference to get the actual version number so I can install the correct version to interface with my Azure environment.
The answer here is to use Cloud Shell directly from the Azure portal. This is no longer a coding question so the community can feel free to do what they want with this.
Check for your Powershell and AzModule versions. The Current API version available is '2019-08-01':
Update your Powershell/AzModule and the command will work just fine. Refer to the documentation:
https://learn.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-2.7.0#requirements
Related
An Azure Automation account runbook uses the ExchangeOnlineManagement module. A particular cmdlet is spewing a long message (below) about updating to version 2.0.6, which is still in preview.
I assume, because it's in preview, it doesn't show up in the "add module from PowerShell Gallery" in the Azure Portal. I cannot figure out how to update our Azure automation account to use 2.0.6-Preview6, and only 2.0.5 is listed for import.
Anyway, how can I suppress this message? I have the runbook getting fired from a MS Flow, and parsing JSON from the runbook output chokes on the unexpected non-JSON string.
Here's the cmdlet in question that produces the message:
$exchangeConnection = Connect-ExchangeOnline -ExchangeEnvironmentName O365USGovGCCHigh –CertificateThumbprint $connection.CertificateThumbprint –AppId $connection.ApplicationID –ShowBanner:$false –Organization $tenant | Out-Null
Here's the annoying message that is output:
=============================================================
New update available!
You are using an older version of Exchange PowerShell cmdlets which may be using (soon to be deprecated) Basic authentication.
Please install version 2.0.6 of the ExchangeOnlineManagement module to upgrade to the latest version of cmdlets, which are REST based, more secure, reliant and performant than the remote PowerShell cmdlets that you are currently using.
For more information on the latest cmdlets released, visit: https://techcommunity.microsoft.com/t5/exchange-team-blog/exchange-online-powershell-v2-module-preview-now-more-secure/ba-p/2922946
To download the latest version of the module, visit https://www.powershellgallery.com/packages/ExchangeOnlineManagement/2.0.6-Preview5
============================================================
I am trying to shutdown the VM using Azure Automation Account System Managed identity option.
However I am ending up with below error.
As per the other articles it is mentioned to upgrade the module Update-ModulesInAutomationToLatestVersion but I could not update due to below error. I am not sure what is the issue in the script. Same script works with AzureRunAsConnection option without issues ( script ).I even checked with simple login with System Managed Identity it successfully login and fetches the resource group names.
I have tested the above shared script in my automation account. Below are
the couple of observations:
You need to use Connect-AzureRMAccount -Identity cmdlet instead of 'connect-AzAccount` to connect to your subscription because the rest of the script that you have written using Azure RM cmdlets.
If we use AzureRM cmdlets in your run book script the job is getting suspended stating that Azure RM is going to retired and suggesting us to use Az Module in your workflow.
You can refer to this documentation on how to migrate your PowerShell scripts automatically from AzureRM to AZ modules.
If you want to perform start/stop on your virtual Machines you can leverage the Azure Automation start/stop during the off hours feature.
According to the MICROSOFT DOCUMENTATION and looking at your script the Azure Rm module is not supported and it has been updated to the latest version of Az module.
For more information please refer the below links:-
MICROSOFT DOCUMENT|Using a system-assigned managed identity for an Azure Automation account & Troubleshoot runbook issue.
I'm simply trying to extract the below information using Az PowerShell.
Resource on portal
Already tried the below commands
Get-AzCloudService -ResourceGroupName "testCosmosDB" # it gives no result.
Get-AzCloudService -ResourceGroupName "testCosmosDB" -CloudServiceName "testnameon" # as shown below.
The reason you're getting this error is because Az PowerShell module only support Cloud Services (Extended Support) and not Cloud Services (Classic).
One option for you is to migrate your classic Cloud Services to Cloud Services (Extended Support). You can learn more about the migration here: https://learn.microsoft.com/en-us/azure/cloud-services-extended-support/overview#migration-to-azure-resource-manager.
Another option (not sure if it is even viable) is to make use of really old version of Azure PowerShell (even before AzureRM) which has support for classic resources.
I have a classic Compute resource. I need to move some old deployment code that used Azure.Service module to Az and I was wondering, is there a way to manage that with Az or something up to date?
I have to upload some .cspkg and some .cscfg files. There is more to it, but basically, this was done using this cmdlet and the related ones, Set, Get etc.
I used Az.Resources' cmdlet New-AzResource to create it:
New-AzResource `
-Location 'location' `
-ResourceGroupName 'rgName' `
-ResourceType 'Microsoft.ClassicCompute/domainNames' `
-ResourceName 'rName' `
-ApiVersion '2018-06-01'
What cmdlets could I use to manage this resource?
In your case, you could use Az.CloudService module commands, to upload some .cspkg and some .cscfg files, use New-AzCloudService with parameters -PackageUrl and -ConfigurationUrl(or -Configuration).
The command New-AzCloudService can Create or update a cloud service, i.e. New, Set operations, to do Get operation, use Get-AzCloudService command.
Anyway, see here for all the commands to manage Microsoft.ClassicCompute/domainNames i.e. Cloud service, use them depends on your requirement.
Update:
In this case, looks you could not migrate your commands to Az module, Az.CloudService is for the new Cloud Service(extended support) which is ARM(Azure Resource Manager) based, and it is in the preview version, see Deploy a Cloud Service (extended support) using Azure PowerShell, some features might not be supported, I think the error was caused by this.
What you are using is Cloud Service(classic), it is ASM(Azure Service Management) based, the new Az module is just for ARM resources.
So in your case, you may need to continue to use Azure.Service module, or you can migrate the ASM to ARM i.e. Cloud Service(classic) to Cloud Service(extended support), see Migration to Azure Resource Manager, but not recommend you to use it in the production environment as it is in preview.
I have an Az script that sets up Advanced Data Security for my Azure SQL Databases/Servers.
Unfortunately, Az cannot run in Azure Devops, so I translated the script to AzureRM. The script leaves Advanced Data Security in a "Partially Configured" state, due to the Azure SQL Server's VULNERABILITY ASSESSMENT SETTINGS not being set.
What is the AzureRM equivalent of Update-AzSqlServerVulnerabilityAssessmentSetting
I tried
Update-AzSqlServerVulnerabilityAssessmentSetting
to:
Update-AzureRmSqlDatabaseVulnerabilityAssessmentSettings
However, only the database gets configured and this leave the Server unconfigured.
They are not an equivalent, the AzureRm module was deprecated and will not be updated.
Unfortunately, Az cannot run in Azure Devops, so I translated the script to AzureRM.
As I know, the Task version with 4.*(preview) supports Az module. I tried it here.
If you want to AzureRm module to update Azure SQL Vulnerability Assessment Setting, you just can use command "update-AzureRmSqlDatabaseVulnerabilityAssessmentSettings" to configure all database in one server, AzureRM does not provide command to enable customers to directly configure Azure SQL server. For more details, please refer to the blog.
Get-AzureRmSqlDatabase -ResourceGroupName $params.rgname -ServerName $params.serverName`
| where {$_.DatabaseName -ne "master"} `
| Update-AzureRmSqlDatabaseVulnerabilityAssessmentSettings `
-RecurringScansInterval Weekly `
-NotificationEmail $scanNotificationEmail `
-EmailAdmins $true"