azure_arc icon indicating copy to clipboard operation
azure_arc copied to clipboard

Deploying Azure IoT Operations - Manufacturing Scenario fails during VM's LogonScript.ps1

Open marshallbentley opened this issue 1 year ago • 2 comments

Note: For ease of issues and pull requests management and tracking, we kindly ask you to provide a meaningful and concise title to this issue and answer all questions to the best of your ability.

Is your issue related to a Jumpstart scenario, ArcBox, HCIBox, or Agora?

Jumpstart: https://azurearcjumpstart.com/azure_arc_jumpstart/azure_edge_iot_ops/aio_manufacturing

Describe the issue or the bug

After following the guide, when provisioning the deploying via azd, my VM fails during the LogonScript.ps1 script. Further troubleshooting reveals many environment variables, such as spnClientID and spnTenantId which should have been set earlier in Bootstrap.ps1 are null. This causes the script to eventually fail and the environment to never come up.

Additional logs from LogonScript.log on the VM:

[4:20 PM] INFO: Configuring Azure PowerShell
PS>TerminatingError(ConvertTo-SecureString): "Cannot bind argument to parameter 'String' because it is null."
ConvertTo-SecureString : Cannot bind argument to parameter 'String' because it is null.
At C:\AIO\PowerShell\LogonScript.ps1:231 char:41
+ $azurePassword = ConvertTo-SecureString $spnClientSecret -AsPlainText ...
+                                         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException
    + FullyQualifiedErrorId : 
ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSecureStringCommand
ConvertTo-SecureString : Cannot bind argument to parameter 'String' because it is null.
At C:\AIO\PowerShell\LogonScript.ps1:231 char:41
+ $azurePassword = ConvertTo-SecureString $spnClientSecret -AsPlainText ...
+                                         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSe
   cureStringCommand

The variable '$azurePassword' cannot be retrieved because it has not been set.
At C:\AIO\PowerShell\LogonScript.ps1:232 char:79
+ ... tem.Management.Automation.PSCredential($spnClientID , $azurePassword)
+                                                           ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (azurePassword:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined
The variable '$azurePassword' cannot be retrieved because it has not been set.
At C:\AIO\PowerShell\LogonScript.ps1:232 char:79
+ ... tem.Management.Automation.PSCredential($spnClientID , $azurePassword)
+                                                           ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (azurePassword:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

The variable '$psCred' cannot be retrieved because it has not been set.
At C:\AIO\PowerShell\LogonScript.ps1:233 char:31
+ Connect-AzAccount -Credential $psCred -TenantId $spnTenantId -Service ...
+                               ~~~~~~~
    + CategoryInfo          : InvalidOperation: (psCred:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined
The variable '$psCred' cannot be retrieved because it has not been set.
At C:\AIO\PowerShell\LogonScript.ps1:233 char:31
+ Connect-AzAccount -Credential $psCred -TenantId $spnTenantId -Service ...
+                               ~~~~~~~
    + CategoryInfo          : InvalidOperation: (psCred:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

To Reproduce

Expected behavior

Follow the guide and deploy via azd, entering the variables as prompted.

Environment summary

Following the guide and deploying via azd deploys successfully.

Have you looked at the Troubleshooting and Logs section?

Screenshots

Additional context

marshallbentley avatar Oct 10 '24 21:10 marshallbentley

Hi marshallbentley! Thank you for opening this issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on the Arc Jumpstart.

Hi @marshallbentley - thanks for reporting the issue. I'm taking a look at the AIO scenario and the error you're describing. I'll follow-up as soon as I can.

mrhoads avatar Oct 10 '24 22:10 mrhoads

Closing this issue after @marshallbentley and I spoke about this. Deployments are now successful. We'll be removed azd from the doc because of issues with service principals.

mrhoads avatar Oct 29 '24 16:10 mrhoads