created NSG by CLI and passing the parameters from task getting the build pipeline as a passing parameter error

Michael P 41 Reputation points
2022-08-17T13:04:06.553+00:00

Hello,

I have the simple CLI script to create the NSG rules and when I pass the parameters from the task it is getting the build pipeline name ias the error into parameters:

this is my CLI:

VARs

NSG_NAME=$1
RG_NAME=$2
LOCATION=$3
SUBSCRIPTION=$4
NSG_VIRTUAL_NETWORK_INBOUND_ALLOW_RULE=$7
NSG_ALLOW_INBOUND_RULE_PRIORITY=$8
NSG_ALLOW_SOURCE_ADDR_PREFIX=$9
echo $NSG_ALLOW_SOURCE_ADDR_PREFIX
NSG_ALLOW_DEST_ADDR_PREFIX="${10}"
echo "$NSG_ALLOW_DEST_ADDR_PREFIX"
NSG_ALLOW_DEST_PORT_RANGES="${11}"
NSG_ALLOW_DIRECTION="${12}"
echo $NSG_ALLOW_DIRECTION
NSG_ALLOW_ACCESS="${13}"
NSG_ALLOW_PROTOCOL="${14}"
NSG_ALLOW_DESCRIPTION="${15}"

az network nsg rule create \
--nsg-name $NSG_NAME \
--resource-group $RG_NAME \
--name $NSG_VIRTUAL_NETWORK_INBOUND_ALLOW_RULE \
--priority $NSG_ALLOW_INBOUND_RULE_PRIORITY \
--source-address-prefixes $NSG_ALLOW_SOURCE_ADDR_PREFIX \
--destination-address-prefixes $NSG_ALLOW_DEST_ADDR_PREFIX \
--destination-port-ranges $NSG_ALLOW_DEST_PORT_RANGES \
--direction $NSG_ALLOW_DIRECTION \
--access $NSG_ALLOW_ACCESS \
--protocol "$NSG_ALLOW_PROTOCOL" \
--description "$NSG_ALLOW_DESCRIPTION"

passing parameters form the task or Release Pipeline:

"$(NSG_NAME)" "$(RG_NAME)" "$(LOCATION_EAST_US)" "$(SUBSCRIPTION_NA_DEV_TEST_ID)" "$(RG_TAG_INHERITED_NON_PROD)" "$(NSG_TAG_NON_PROD)" "$(NSG_VIRTUAL_NETWORK_INBOUND_ALLOW_RULE)" "$(NSG_ALLOW_INBOUND_RULE_PRIORITY)" "$(NSG_ALLOW_SOURCE_ADDR_PREFIX)" "$(NSG_ALLOW_DEST_ADDR_PREFIX)" "$(NSG_ALLOW_DEST_PORT_RANGES)" "$(NSG_ALLOW_DIRECTION_1)" "$(NSG_ALLOW_ACCESS)" "$(NSG_ALLOW_PROTOCOL)" "$(NSG_ALLOW_DESCRIPTION)"

ERROR:

2022-08-17T02:21:39.4946452Z 10.255.253.64/28
2022-08-17T02:21:39.4947451Z *
2022-08-17T02:21:39.4948174Z Inbound
2022-08-17T02:21:41.3465407Z ERROR: (SecurityRuleInvalidAddressPrefix) Security rule /subscriptions/xxxxxxxxxxxxxxxxx/resourceGroups/02_MP_RG_NA_DEV_TEST/providers/Microsoft.Network/networkSecurityGroups/02_MP_DEV_NSG_NA_DEV_TEST/securityRules/02_MP_VIRTUAL_NETWORK_INBOUND_ALLOW has invalid Address prefix. Value provided: VM_BUILD_ORD_PIPE
2022-08-17T02:21:41.3466825Z Code: SecurityRuleInvalidAddressPrefix
2022-08-17T02:21:41.3467811Z Message: Security rule /subscriptions/xxxxxxxxxxxxxxxxx/resourceGroups/02_MP_RG_NA_DEV_TEST/providers/Microsoft.Network/networkSecurityGroups/02_MP_DEV_NSG_NA_DEV_TEST/securityRules/02_MP_VIRTUAL_NETWORK_INBOUND_ALLOW has invalid Address prefix. Value provided: VM_BUILD_ORD_PIPE
2022-08-17T02:21:41.5281504Z ##[error]Script failed with exit code: 1

I did the echo to display the source prefix and it displayed the correct one:

10.255.253.64/28

but I do not understand where and why the name of my Build Pipeline = VM_BUILD_ORD_PIPE is coming from ?

please help me if you had this kind of problem before.

Thank you.
Michael.

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,133 questions
{count} votes