question

RavikumarP-8333 avatar image
0 Votes"
RavikumarP-8333 asked ·

How can we find Properties or Config setting of Azure Resources using PowerShell?

Hi All

How can we find Properties or Config setting of Azure Resources using PowerShell?

In which situation do we need to use APIVERSION in PowerShell

I need to change my config setting on Azure resources using PowerShell

Could you please help me to understand the concept of this

Regards,

Ravi P

azure-webappsazure-application-gatewayazure-service-bus
· 3
10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

For which Azure service you are trying to get the properties?

0 Votes 0 ·

Taking Webapp, and Application gateway and at which situation do need to use below comment APIVERSION

I need to change properties of Services such webapp,Service bus, AppGW

How to change it and how to find Properties of that Resources


$APIVersion = ((Get-AzResourceProvider -ProviderNamespace Microsoft.Web).ResourceTypes | Where-Object ResourceTypeName -eq sites).ApiVersions[0]



0 Votes 0 ·

Sorry, not so experienced in webapp area. But see if the PowerShell cmdlets in below helps

https://docs.microsoft.com/en-us/powershell/module/az.websites/?view=azps-4.8.0

0 Votes 0 ·

1 Answer

krish-gh avatar image
0 Votes"
krish-gh answered ·

@RavikumarP-8333 , To get 'Properties' of any type of Azure resources in Powershell, you can use Get-AzResource in Powershell. For example:

 (Get-AzResource  -Name myWebApp -ResourceGroupName myResourceGroup).Properties

will show the properties of the web app named 'myWebApp' in resource group 'myResourceGroup'. There are many variations of the 'Get-AzResource' cmdlet input which you can explore here.

If you are looking specifically for config settings for any specific type of resources then the command will depend on the type of the resource. For example in Web App, you can use Set-AzWebApp.

 Set-AzWebApp -Name myWebApp -ResourceGroupName myResourceGroup -AppSettings @{myKey1=myValue1; myKey2=myValue2;}

You can explore the required cmdlet for your specific service in PowerShell Module Browser. For overall Azure powershell walkthrough, you can refer Azure PowerShell documentation

Regarding your question,

In which situation do we need to use APIVERSION in PowerShell

You don't need actually for Powershell. APIVERSION is applicable for the exposed APIs for the management APIs of different resources behind the scene. When you use Powershell cmdlet, it calls a specific version of the API tied to version of the Az module you are using (for example, it might be 2018-10-12 for a specific module). You might come across a situation when a new feature/update is possible in a newer API version in future at which point you need to update your Az modules if you want to leverage that. Also, Azure maintains several old API versions for sometime for backwards compatibility with old code/script. For overall resource management, you can refer Managing resources documentation.

Note: On the other hand if you use ARM template for resource deployment, you have a option of specifying API version in the template json itself.

10 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.