I'm deploying an Azure function app as a part of security implementation into and I'm getting the above mentioned error as mentioned in Title section. Here is the powershell script i am running
az deployment group create
--name fss-promote-or-quarantine-plugin-deployment
--resource-group $RESOURCE_GROUP_NAME
--template-uri https://raw.githubusercontent.com/trendmicro/cloudone-filestorage
plugins/master/post-scan-actions/azure-python-promote-or-quarantine/template.json
-p promoteOrQuarantineFunctionName=$FUNCTION_NAME
scanningStorageAccountResourceID=$BLOB_STORAGE_ACCOUNT_RESOURCE_ID
scanResultTopicResourceID=$SCAN_RESULT_TOPIC_RESOURCE_ID
promoteStorageAccountConnectionString="$PROMOTE_STORAGE_ACCOUNT_CONNECTION_STRING"
promoteMode=move
quarantineStorageAccountConnectionString="$QUARANTINE_STORAGE_ACCOUNT_CONNECTION_STRING"
quarantineMode=move
Screenshot of the error that I'm getting:
I have tried by giving the space between the parameter names and values and it given the same error:
This cmdlet creates the storage account, taken from the GitHub ARM Article.
As #Mathias R. Jessen said, there should be no space between the parameter names and arguments passed in the CLI Cmdlets:
Related
I have two resource groups in Azure, each contains one VMSS (Virtual Machine Scale Sets) and the resources are visible in Azure Portal. The problem is, the following commands return empty output:
az resource list --subscription MySubscription -g vmss-rg
az vmss list --subscription MySubscription -g vmss-rg
az vmss list
However, running az resource list with different resource groups which doesn't have VMSS works fine. I also tested it with different Azure account and subscription, it also worked.
We have tested the same command in our local as suggested by #VenkateshDodda-MT and it works fine. Posting it as an answer to help other community members for the similar issue so that they can find and fix their problem.
To achieve the above requirement we need to install the az powershell module in our local .
Post that run the command in powershell to get the vmss list under our subscription or resource groups:-
az resource list --resource-type "Microsoft.Compute/virtualMachineScaleSets"
OUTPUT:-
To get the VMSS list under particular resource group run the below cmd:
az resource list --resource-type "Microsoft.Compute/virtualMachineScaleSets" -g '<rgName>'
OUTPUT:-
For more information please refer this SO THREAD:Azure PS command returns empty list as suggested by #Olga Osinskaya - MSFT
We have a situation where we want to automate the logic app creation and update. We are writing a powershell to automate the deployment.
We are trying to deploy the logic app in our integration service environment.
How do we use the --integration-service-environment parameter ?
we cannot find any example on the web nor useful documentation.
In our powershell, we have the last line as follow:
az logic workflow create --resource-group $resgrp --integration-service-environment $iseName --location $location --name $logicappname --definition $appTemplatePath --state $state
This gets us usage error: --integration-service-environment [KEY=VALUE ...]
Help?
You should use 'id= <Resource id>' as the parameter value for --integration-service-environment
The resource id is usually found in the portal.
Try the below snippet
#Your resource id will be in this format
$ise = 'id= /subscriptions/<SUB_ID>/resourceGroups/<RESOURCEgroup>/providers/Microsoft.Logic/integrationServiceEnvironments/<ISE_NAME>'
#your earlier command with modification of the ise value.
az logic workflow create --resource-group $resgrp --name $logicappname --definition $appTemplatePath --location $location --integration-service-environment $ise
Note :
Ensure,location of the logic app and ise are the same.
I tried various regions still same problem, here the error message :
Error Message : Code=InvalidTemplateDeployment; Message=The template
deployment failed with error: 'The resource with id:
'/subscriptions/----------------------/providers/Microsoft.Compute/virtualMachines/ARM_VM-001'
failed validation with message: 'The requested size for resource
'/subscriptions/--------------/resourceGroups/AzureResourceGroup1-2/providers/Microsoft.Compute/virtualMachines/ARM_VM-001'
is currently not available in location 'westus' zones '' for
subscription '-----------'.
Please try another size or deploy to a different location or zones.
See https://aka.ms/azureskunotavailable for details.'.'.
The deployment validation failed
Since not all SKU are available in all regions in Azure, you can use CLI to figure out whether the SKU you are looking for is available or not.
az vm list-skus --location <region> --query "[].{name:name}" -o table
You can use the above Azure CLI command to determine if the VM Size you are looking for is available in the given region (westus in your case).
you can provide the Size also and get a more narrowed down result as well
az vm list-skus --location <region> --size Standard_ --query "[].{name:name}" -o table
the above will provide all the Standard sizes avaliable in
if you want to find if a specific size is available in a specific region, try the below command
az vm list-skus --location southcentralus --size Standard_DS14-8_v2 --output table
This link > [https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest] has list of CLI commands you can execute for operations relating to VMs
Hope this helps.
I am trying to make a dynamic Azure CLI Task in Azure DevOps that will let us reuse the task. My biggest issue right now is dynamically setting the --advanced-filter on the command.
I have looked at the documentation here, https://learn.microsoft.com/en-us/azure/event-grid/how-to-filter-events, and the only place it shows using a variable for the filter is in the PowerShell command not the Azure CLI. I have tried to replicate that syntax for the CLI, but it fails.
Here is the command I am trying to run. I took the syntax for the filter from the above Microsoft doc.
$eventSubscriptionFilter = #{operator="StringContains"; key="data.messageTypeUri"; Value=#("myUriHere")}
az eventgrid event-subscription create --endpoint-type azurefunction --name $topicSubName --source-resource-id $topicid --endpoint $functionEndPoint --deadletter-endpoint $storageid/blobServices/default/containers/$containername --advanced-filter #($eventSubscriptionFilter)
If I run this without the --advanced-filter it works perfectly, but as soon as I add --advanced-filter I get this error:
az : usage error: --advanced-filter KEY[.INNERKEY] FILTEROPERATOR VALUE [VALUE ...]
Is this what I am going to have to do?
--advanced-filter data.$myMember StringContains $myValue
I am not even sure if that is going to work. I am going to have to hard code it in there, and that kills the ability to make this dynamic.
Any thoughts?
If you want to specify --advanced-filter in Azure CLI command, it should be like --advanced-filter [key] [operation] [value]. For more details, please refer to the document
For example(I test it in Powershell)
$key="data.Message"
$opreation="StringContains"
$value=#("test","test1")
az eventgrid event-subscription create
--name $topicSubName
--source-resource-id $topicid
--endpoint $functionEndPoint
--deadletter-endpoint $storageid/blobServices/default/containers/$containername
--advanced-filter $key $opreation $value
I'm using Azure CLI v2.0.62.
I do have multiple subscriptions - S1, S2, S3, S4 - in Azure on the single account.
I'm executing below script to insert dynamic value into repository:
az login
az acr build "ParentStorage" --platform windows -f Dockerfile -t ChildRepository:<dynamicValue>
Here, ParentStorage is of Storage Account type and ChileRepository is of Repository type.
At first, when login command gets executed, it gives me list of available subscription. But after executing az acr build... command it is throwing error message as below:
Error
The resource with name 'ParentStorage' and type
'Microsoft.ContainerRegistry/registries' could not be found in
subscription 'Visual Studio Professional
(ID)'.
What I have found till now is, it is trying to search under my Visual Studio subscription (S1). As S1 was the default subscription and repository was in S2. So I set S2 as default subscription and tried again but it didn't work.
Event when I tried to execute below command, it threw the same error:
az acr show --name ParentStorage
P.S.: I tried to login with specific subscription but unable to do so.
Please let me know what is I'm missing here.
For your issue, it seems your registry is not in the current subscription. When you use the CLI command az login then you log in with a default subscription. For you, it seems the "Visual Studio Professional (ID)" is the default. You should check if your registry is in the current subscription. If not, you should set that subscription as the current subscription through the CLI command:
az account set --subscription subscription_id
Then I suggest you'd better check if the registry exists again with the CLI command:
az acr show -n acr_name
It will show the information of your registry. This time, you can build the image with the CLI command az acr build as you want.
Also, you can set the subscription in the login time with the parameter --subscription through the CLI command az login.
If you have more questions, please let me know. Or if you think it's helpful you can accept it as the answer.
I ran into this and found another issue. The service provider (SP) I was using only had the "Acr Push" role. I had to add the "Contributor" role to resolve the issue. So it appears "Acr Push" does not have enough permissions to see the ACR resource.
Just adding an additional thing by following the answer provided in here
We can use below command to build with specific subscription id so that whenever the multiple users want to execute this command with their different default subscription id, they don't need to make other subscription as their default.
az acr build --subscription $SubscriptionId -r $registry --platform Windows -f Dockerfile -t XYZ:v$version obj
Hope this helps others too.