Create Search Service using Powershell api need to be update
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"
}
}
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
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @brjohnstmsft, @bleroy, @tjacobhi, @markheff, @miwelsh.
Search team, please evaluate this request.
FYI @tjacobhi
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.
hi @tjacobhi please check about issue, it's like not only me met it. thanks
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.
@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.
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.
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.