azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Create Search Service using Powershell api need to be update

Open Scarlettliuyc opened this issue 6 years ago • 9 comments

Description

We have a policy to append ipRules, when use Azure Portal create it, it can append the IP list, but when create it Azure powershell New-AzSearchService it cannot append it. Then we troubleshoot the issue it's like the api of Search service Powershell still in old version 2015-08-19

Steps to reproduce

Create Search service using Powershell: New-AzSearchService -ResourceGroupName "gridResourceGroup" -Name "testpowershell2" -Sku "Basic" -Location "UK South" -PartitionCount 1 -ReplicaCount 1 -HostingMode Default

here is the latest version { "name": "string", "type": "Microsoft.Search/searchServices", "apiVersion": "2020-03-13", "location": "string", "tags": {}, "identity": { "type": "string" }, "properties": { "replicaCount": "integer", "partitionCount": "integer", "hostingMode": "string", "publicNetworkAccess": "string", "networkRuleSet": { "ipRules": [ { "value": "string" } ] } }, "sku": { "name": "string" }, "resources": [] }

Then I found the template for 2015-08-19 don't have the ipRules array. so we cannot append Policy when create the Azure Search service { "name": "string", "type": "Microsoft.Search/searchServices", "apiVersion": "2015-08-19", "location": "string", "tags": {}, "identity": { "type": "string" }, "properties": { "replicaCount": "integer", "partitionCount": "integer", "hostingMode": "string" }, "sku": { "name": "string" } } image here is the doc shows versions. https://docs.microsoft.com/en-us/rest/api/searchservice/search-service-api-versions#stable-versions


Module versions

ModuleType Version PreRelease Name PSEdition ExportedCommands


Script 0.7.4 Az.Search Core,Desk {New-AzSearchService, Get-AzSearchService, Set-AzSearchService, Remove-AzSearchService…}


Please help to update the API version

Scarlettliuyc avatar Oct 28 '20 02:10 Scarlettliuyc

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @brjohnstmsft, @bleroy, @tjacobhi, @markheff, @miwelsh.

ghost avatar Oct 28 '20 13:10 ghost

Search team, please evaluate this request.

dingmeng-xue avatar Oct 28 '20 13:10 dingmeng-xue

FYI @tjacobhi

bitsforthought avatar Oct 28 '20 17:10 bitsforthought

This is badly affecting us. It effectively renders our policy useless as a governance tool because it allows teams to create Azure Cognitive Search instances that do not comply with our policies, only by using PowerShell Az to create them.

Just fixing the PowerShell Az module will not be enough, thought. The ARM endpoint that is being targetted also needs to be updated so that there is no way to bypass the policy.

rodolfograve avatar Nov 02 '20 11:11 rodolfograve

hi @tjacobhi please check about issue, it's like not only me met it. thanks

Scarlettliuyc avatar Nov 02 '20 11:11 Scarlettliuyc

Hi @rodolfograve and @Scarlettliuyc - I apologize for the delay on this. We will work to get this fixed. I'll reply back when I have a better update for you.

dereklegenzoff avatar Nov 03 '20 20:11 dereklegenzoff

@rodolfograve - could you provide some additional details on how you've configured your policy? An enforced policy should look for a property to be set on the service. If you use an older version of the API, Powershell included, I’d expect the create to fail since the property doesn’t exist.

dereklegenzoff avatar Nov 03 '20 21:11 dereklegenzoff

Hi folks - a quick update on this. We currently expect the updates for this to be in early next calendar year. I apologize for the delay.

In the meantime, the best workaround would be to deploy an ARM template via PowerShell as described in this article.

dereklegenzoff avatar Dec 07 '20 19:12 dereklegenzoff

The Az.Search Powershell module has now been updated.

Below is an example of creating a search service with IP Rules configured. Documentation is available here.

$ipRules = @([pscustomobject]@{Value="55.5.63.73"},
		[pscustomobject]@{Value="52.228.215.197"},
		[pscustomobject]@{Value="101.37.221.205"})

 New-AzSearchService -ResourceGroupName <resource-group-name> `
                      -Name <search-service-name> `
                      -Sku Basic `
                      -Location "West US" `
                      -PartitionCount 1 -ReplicaCount 1 `
                      -HostingMode Default `
                      -IPRuleList $ipRules

I'll proceed with closing this issue. Please feel free to let us know if you have any problems.

dereklegenzoff avatar Feb 09 '21 17:02 dereklegenzoff